2023-02-21 05:04:35 -08:00
|
|
|
name: 'Release: Publish'
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- closed
|
|
|
|
branches:
|
2023-06-27 07:15:29 -07:00
|
|
|
- 'release/*'
|
2023-02-21 05:04:35 -08:00
|
|
|
|
|
|
|
jobs:
|
2024-08-22 02:41:53 -07:00
|
|
|
publish-to-npm:
|
|
|
|
name: Publish to NPM
|
2023-02-21 05:04:35 -08:00
|
|
|
runs-on: ubuntu-latest
|
2024-08-22 02:41:53 -07:00
|
|
|
if: github.event.pull_request.merged == true
|
|
|
|
timeout-minutes: 10
|
2024-08-28 03:28:12 -07:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
2024-06-19 03:15:13 -07:00
|
|
|
env:
|
|
|
|
NPM_CONFIG_PROVENANCE: true
|
2024-08-22 02:41:53 -07:00
|
|
|
outputs:
|
|
|
|
release: ${{ steps.set-release.outputs.release }}
|
2023-02-21 05:04:35 -08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-01-26 02:26:30 -08:00
|
|
|
uses: actions/checkout@v4.1.1
|
2023-02-21 05:04:35 -08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2024-02-02 00:47:58 -08:00
|
|
|
- run: corepack enable
|
2024-05-24 03:32:50 -07:00
|
|
|
- uses: actions/setup-node@v4.0.2
|
2023-02-21 05:04:35 -08:00
|
|
|
with:
|
2024-05-24 03:32:50 -07:00
|
|
|
node-version: 20.x
|
2023-02-21 05:04:35 -08:00
|
|
|
cache: 'pnpm'
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
|
2023-04-05 08:14:41 -07:00
|
|
|
- name: Set release version in env
|
|
|
|
run: echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> $GITHUB_ENV
|
|
|
|
|
2023-02-21 05:04:35 -08:00
|
|
|
- name: Build
|
|
|
|
run: pnpm build
|
|
|
|
|
2023-11-29 03:03:19 -08:00
|
|
|
- name: Dry-run publishing
|
|
|
|
run: pnpm publish -r --no-git-checks --dry-run
|
|
|
|
|
2023-02-21 05:04:35 -08:00
|
|
|
- name: Publish to NPM
|
|
|
|
run: |
|
|
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
2024-07-10 08:08:00 -07:00
|
|
|
node .github/scripts/trim-fe-packageJson.js
|
|
|
|
node .github/scripts/ensure-provenance-fields.mjs
|
2023-10-09 09:12:48 -07:00
|
|
|
sed -i "s/default: 'dev'/default: 'stable'/g" packages/cli/dist/config/schema.js
|
2023-08-31 05:05:12 -07:00
|
|
|
pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc --no-git-checks
|
2023-04-26 07:08:02 -07:00
|
|
|
npm dist-tag rm n8n rc
|
2023-02-21 05:04:35 -08:00
|
|
|
|
2024-08-22 02:41:53 -07:00
|
|
|
- id: set-release
|
|
|
|
run: echo "release=${{ env.RELEASE }}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
publish-to-docker-hub:
|
|
|
|
name: Publish to DockerHub
|
|
|
|
needs: [publish-to-npm]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event.pull_request.merged == true
|
|
|
|
timeout-minutes: 10
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4.1.1
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3.0.0
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v3.0.0
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v3.0.0
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
uses: docker/build-push-action@v5.1.0
|
|
|
|
with:
|
|
|
|
context: ./docker/images/n8n
|
|
|
|
build-args: |
|
|
|
|
N8N_VERSION=${{ needs.publish-to-npm.outputs.release }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
provenance: false
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
${{ secrets.DOCKER_USERNAME }}/n8n:${{ needs.publish-to-npm.outputs.release }}
|
|
|
|
ghcr.io/${{ github.repository_owner }}/n8n:${{ needs.publish-to-npm.outputs.release }}
|
|
|
|
|
|
|
|
create-github-release:
|
|
|
|
name: Create a GitHub Release
|
|
|
|
needs: [publish-to-npm, publish-to-docker-hub]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event.pull_request.merged == true
|
|
|
|
timeout-minutes: 5
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
2023-04-26 07:08:02 -07:00
|
|
|
- name: Create a Release on GitHub
|
2023-02-21 05:04:35 -08:00
|
|
|
uses: ncipollo/release-action@v1
|
|
|
|
with:
|
|
|
|
commit: ${{github.event.pull_request.base.ref}}
|
2024-08-22 02:41:53 -07:00
|
|
|
tag: 'n8n@${{ needs.publish-to-npm.outputs.release }}'
|
2023-04-26 07:08:02 -07:00
|
|
|
prerelease: true
|
|
|
|
makeLatest: false
|
2023-06-27 07:15:29 -07:00
|
|
|
body: ${{github.event.pull_request.body}}
|
2023-04-26 07:08:02 -07:00
|
|
|
|
2024-08-22 02:41:53 -07:00
|
|
|
trigger-release-note:
|
|
|
|
name: Trigger a release note
|
|
|
|
needs: [publish-to-npm, create-github-release]
|
|
|
|
if: github.event.pull_request.merged == true
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-04-26 07:08:02 -07:00
|
|
|
- name: Trigger a release note
|
2024-08-22 02:41:53 -07:00
|
|
|
run: curl -u docsWorkflows:${{ secrets.N8N_WEBHOOK_DOCS_PASSWORD }} --request GET 'https://internal.users.n8n.cloud/webhook/trigger-release-note' --header 'Content-Type:application/json' --data '{"version":"${{ needs.publish-to-npm.outputs.release }}"}'
|
|
|
|
|
|
|
|
merge-back-into-master:
|
|
|
|
name: Merge back into master
|
|
|
|
needs: [publish-to-npm, create-github-release]
|
|
|
|
if: ${{ github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'release:patch') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4.1.1
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- run: |
|
|
|
|
git checkout --track origin/master
|
|
|
|
git config user.name "github-actions[bot]"
|
|
|
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
|
|
git merge --ff n8n@${{ needs.publish-to-npm.outputs.release }}
|
|
|
|
git push origin master
|
|
|
|
git push origin :${{github.event.pull_request.base.ref}}
|