Skip to content

refactor: use only goreleaser to build unsigned chainlink images in one workflow #4380

refactor: use only goreleaser to build unsigned chainlink images in one workflow

refactor: use only goreleaser to build unsigned chainlink images in one workflow #4380

name: "Build and Publish Chainlink"
on:
pull_request:
branches-ignore:
- 'release/**'
push:
branches:
- develop
workflow_dispatch:
inputs:
git_ref:
description: "Git ref (commit SHA, branch name, tag name, etc.) to checkout"
required: true
env:
GIT_REF: ${{ github.event.inputs.git_ref || github.ref }}
jobs:
validate-git-ref:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Validate GIT_REF
if: ${{ github.event.inputs.git_ref }}
run: |
if ! git rev-parse --verify "${{ env.GIT_REF }}" > /dev/null 2>&1; then
echo "Invalid GIT_REF: ${{ env.GIT_REF }}"
exit 1
fi
goreleaser-build-publish-chainlink:
needs: [validate-git-ref]
runs-on:
labels: ubuntu22.04-16cores-64GB
environment: build-develop
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ env.GIT_REF }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }}
aws-region: ${{ secrets.AWS_REGION }}
mask-aws-account-id: true
role-session-name: goreleaser-build-publish-chainlink
- name: Build and publish images
id: goreleaser-build-publish
uses: ./.github/actions/goreleaser-build-sign-publish
with:
enable-docker-publish: "true"
docker-registry: ${{ secrets.AWS_DEVELOP_ECR_HOSTNAME }}
docker-image-name: chainlink
enable-goreleaser-snapshot: "true"
goreleaser-exec: ./tools/bin/goreleaser_wrapper
goreleaser-config: .goreleaser.develop.yaml
goreleaser-key: ${{ secrets.GORELEASER_KEY }}
zig-version: 0.11.0
- name: Output image name and digest
shell: bash
run: |
echo "### Docker Images" | tee -a "$GITHUB_STEP_SUMMARY"
jq -r '.[] | select(.type == "Archive") | "`\(.goarch)-digest`: \(.extra.Checksum)"' dist/artifacts.json >> output.txt
while read -r line; do
if [[ $line == *"amd64-digest"* ]]; then
echo "\`amd64-image\`: ${private_sdlc}/chainlink:${GIT_REF}-amd64" | tee -a "$GITHUB_STEP_SUMMARY"
echo "$line" | tee -a "$GITHUB_STEP_SUMMARY"
fi
if [[ $line == *"arm64-digest"* ]]; then
echo "\`arm64-image\`: ${private_sdlc}/chainlink:${GIT_REF}-arm64" | tee -a "$GITHUB_STEP_SUMMARY"
echo "$line" | tee -a "$GITHUB_STEP_SUMMARY"
fi
done < output.txt
echo "$GITHUB_STEP_SUMMARY"
- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
id: goreleaser-build-publish
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: goreleaser-build-publish-chainlink
continue-on-error: true