ci: Add blacksmith build step and cache restore (#19563)

This commit is contained in:
Declan Carroll
2025-09-16 09:59:39 +01:00
committed by GitHub
parent 7d988dbf84
commit 879e8f17ec
4 changed files with 45 additions and 11 deletions

2
.actrc
View File

@@ -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
--container-architecture linux/amd64

View File

@@ -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

View File

@@ -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' ||

View File

@@ -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