diff --git a/.github/actions/goreleaser-build-sign-publish/action.yml b/.github/actions/goreleaser-build-sign-publish/action.yml index f972678b6a9..c707903c1e2 100644 --- a/.github/actions/goreleaser-build-sign-publish/action.yml +++ b/.github/actions/goreleaser-build-sign-publish/action.yml @@ -31,7 +31,7 @@ inputs: required: false docker-image-name: description: The docker image name - default: chainlink-develop + default: chainlink required: false docker-image-tag: description: The docker image tag diff --git a/.github/workflows/build-publish-develop.yml b/.github/workflows/build-publish-develop-pr.yml similarity index 73% rename from .github/workflows/build-publish-develop.yml rename to .github/workflows/build-publish-develop-pr.yml index bc3b8ef03f2..a800faca285 100644 --- a/.github/workflows/build-publish-develop.yml +++ b/.github/workflows/build-publish-develop-pr.yml @@ -2,53 +2,39 @@ 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: Get image tag + id: get-image-tag + run: | + short_sha=$(git rev-parse --short HEAD) + if [[ ${{ github.event }} == 'pull_request' ]]; then + if [[ ${{ github.head_ref }} == 'release/'* ]]; then + echo "image-tag=release-${short_sha}" >> $GITHUB_OUTPUT + else + echo "image-tag=pr-${{ github.event.number }}-${short_sha}" >> $GITHUB_OUTPUT + fi + else + echo "image-tag=develop-${short_sha}" >> $GITHUB_OUTPUT + fi - 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-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_BUILD_PUBLISH_DEVELOP_PR }} role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }} aws-region: ${{ secrets.AWS_REGION }} mask-aws-account-id: true @@ -61,6 +47,7 @@ jobs: enable-docker-publish: "true" docker-registry: ${{ secrets.AWS_DEVELOP_ECR_HOSTNAME }} docker-image-name: chainlink + docker-image-tag: ${{ steps.get-image-tag.outputs.image-tag }} enable-goreleaser-snapshot: "true" goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index ed4ebb36853..04aea936a04 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -4,7 +4,7 @@ project_name: chainlink env: - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} - IMAGE_PREFIX={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }} - - IMAGE_NAME={{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else }}chainlink-develop{{ end }} + - IMAGE_NAME={{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else }}chainlink{{ end }} - IMAGE_TAG={{ if index .Env "IMAGE_TAG" }}{{ .Env.IMAGE_TAG }}{{ else }}develop{{ end }} - IMAGE_LABEL_DESCRIPTION="node of the decentralized oracle network, bridging on and off-chain computation" - IMAGE_LABEL_LICENSES="MIT"