-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CI] Release artifacts job: binaries and containers #523
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Release artifacts | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release-artifacts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 | ||
|
||
- name: install ignite | ||
run: | | ||
make ignite_install | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22.2" | ||
|
||
- name: Install CI dependencies | ||
run: make install_ci_deps | ||
|
||
- name: Generate protobufs | ||
run: make proto_regen | ||
|
||
- name: Generate mocks | ||
run: make go_mockgen | ||
|
||
- name: Build and extract binaries for container build | ||
run: | | ||
make ignite_update_ldflags | ||
make ignite_release | ||
make ignite_release_extract_binaries | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker Metadata action | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
env: | ||
DOCKER_METADATA_PR_HEAD_SHA: "true" | ||
with: | ||
images: | | ||
ghcr.io/pokt-network/poktrolld | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=ref,event=tag,suffix=-prod | ||
type=sha,suffix=-prod | ||
type=sha,format=long,suffix=-prod | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
file: Dockerfile.release | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
|
||
# TODO(@okdas): use for releases (also change the "on" part at the top so it only tgirrered for tags/releases) | ||
- name: Add release and publish binaries | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
release/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Run `asdf plugin add golang` and `asdf install` to install the dependencies, | ||
# and `asdf current` to switch to the versions of dependencies listed below | ||
golang 1.21.6 | ||
go 1.21.6 | ||
golang 1.22.2 | ||
go 1.22.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This Dockerfile is used to build container image for production workloads. | ||
# It relies on the binaries produced by `ignite_release` and `ignite_release_extract_binaries` make targets. | ||
FROM alpine:3.19 | ||
ARG TARGETARCH | ||
|
||
# Use `1025` G/UID so users can switch between this and `heighliner` image without a need to chown the files. | ||
RUN addgroup --gid 1025 -S pocket && adduser --uid 1025 -S pocket -G pocket | ||
|
||
COPY --chown=pocket:pocket release_binaries/poktroll_linux_$TARGETARCH /bin/poktrolld | ||
|
||
USER pocket | ||
|
||
ENTRYPOINT ["poktrolld"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the poktrolld binary the entrpoint? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
glad you asked. It allows to easy set up a shell alias to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #PUC
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @okdas ☝️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this on the
push
trigger, but we don't have a good way to test the release creation from tag. Let's create the first tag after this is merged to test this CI job fully.