From 879e8f17ec9b7d23c7e311d4937d4f08009f91aa Mon Sep 17 00:00:00 2001 From: Declan Carroll Date: Tue, 16 Sep 2025 09:59:39 +0100 Subject: [PATCH] ci: Add blacksmith build step and cache restore (#19563) --- .actrc | 2 +- .github/actionlint.yaml | 2 + .github/workflows/docker-build-push.yml | 2 +- .github/workflows/release-publish.yml | 50 ++++++++++++++++++++----- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/.actrc b/.actrc index 13abf9cbeb..aa35ed576c 100644 --- a/.actrc +++ b/.actrc @@ -2,4 +2,4 @@ -P blacksmith-4vcpu-ubuntu-2204=ubuntu-latest -P ubuntu-22.04=ubuntu-latest -P ubuntu-20.04=ubuntu-latest ---container-architecture linux/amd64 \ No newline at end of file +--container-architecture linux/amd64 diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 6ba9399f2d..c23d817117 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -2,3 +2,5 @@ self-hosted-runner: labels: - blacksmith-2vcpu-ubuntu-2204 - blacksmith-4vcpu-ubuntu-2204 + - blacksmith-2vcpu-ubuntu-2204-arm + - blacksmith-4vcpu-ubuntu-2204-arm diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index f8ae294666..6821b8dd68 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -556,7 +556,7 @@ jobs: security-scan: name: Security Scan - needs: [determine-build-context, build-and-push-docker] + needs: [determine-build-context, build-and-push-docker, create_multi_arch_manifest] if: | success() && (needs.determine-build-context.outputs.release_type == 'stable' || diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 143d7e7049..28495ac420 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -7,11 +7,45 @@ on: branches: - 'release/*' +env: + BUILD_CACHE_KEY: ${{ github.sha }}-release:build + jobs: + build-amd64: + runs-on: blacksmith-4vcpu-ubuntu-2204 + if: github.event.pull_request.merged == true + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Setup Environment + uses: ./.github/actions/setup-nodejs-blacksmith + + - name: Cache to GH + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ./packages/**/dist + key: ${{ env.BUILD_CACHE_KEY }} + + build-arm64: + runs-on: blacksmith-4vcpu-ubuntu-2204-arm + if: github.event.pull_request.merged == true + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + - name: Setup and Build ARM64 + uses: ./.github/actions/setup-nodejs-blacksmith + publish-to-npm: name: Publish to NPM + needs: build-amd64 runs-on: ubuntu-latest - if: github.event.pull_request.merged == true timeout-minutes: 15 permissions: id-token: write @@ -39,14 +73,12 @@ jobs: - name: Set release version in env run: echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> "$GITHUB_ENV" - - name: Build - run: pnpm build - - - name: Cache build artifacts - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + - name: Restore build artifacts + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: + fail-on-cache-miss: true path: ./packages/**/dist - key: ${{ github.sha }}-release:build + key: ${{ env.BUILD_CACHE_KEY }} - name: Dry-run publishing run: pnpm publish -r --no-git-checks --dry-run @@ -71,7 +103,7 @@ jobs: publish-to-docker-hub: name: Publish to DockerHub - needs: [publish-to-npm] + needs: [publish-to-npm, build-arm64] uses: ./.github/workflows/docker-build-push.yml with: n8n_version: ${{ needs.publish-to-npm.outputs.release }} @@ -115,7 +147,7 @@ jobs: uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ./packages/**/dist - key: ${{ github.sha }}-release:build + key: ${{ env.BUILD_CACHE_KEY }} - name: Create a frontend release uses: getsentry/action-release@e769183448303de84c5a06aaaddf9da7be26d6c7 # v1.7.0