Skip to content

Commit

Permalink
ci: Update release-publish on feat/* branch to bitovi docker hub (#4)
Browse files Browse the repository at this point in the history
* switch trigger to feat/*

* Remove on PR closed release-publish workflow

* Try basic release publish

* Swap to dockerhub

* update specific uses and context for build and push

* add context

* reset context to .

* change context to n8n

* Add build-args and tags to build-and-push job

* Re-add publish-to-npm job for build-and-push

* Fix multi-job error

* remove rm n8n rc dist-tag line

* change registry for docker login

* point back to docker.io for publish

* remove ghrc repo url

---------

Co-authored-by: Emil Kais <[email protected]>
  • Loading branch information
EmilK15 and Emil Kais authored Jan 3, 2025
1 parent 0ba4c6e commit b32efbd
Showing 1 changed file with 31 additions and 127 deletions.
158 changes: 31 additions & 127 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: 'Release: Publish'
name: 'Build and Publish Docker Image'

on:
pull_request:
types:
- closed
push:
branches:
- 'release/*'
- 'feat/*'

jobs:
publish-to-npm:
name: Publish to NPM
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
timeout-minutes: 10
permissions:
id-token: write
contents: read
packages: write
env:
NPM_CONFIG_PROVENANCE: true
outputs:
Expand All @@ -24,7 +23,6 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0

- run: corepack enable
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -54,133 +52,39 @@ jobs:
node .github/scripts/ensure-provenance-fields.mjs
sed -i "s/default: 'dev'/default: 'stable'/g" packages/cli/dist/config/schema.js
pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc --no-git-checks
npm dist-tag rm n8n rc
- id: set-release
run: echo "release=${{ env.RELEASE }}" >> $GITHUB_OUTPUT

publish-to-docker-hub:
name: Publish to DockerHub
build-and-push:
needs: [publish-to-npm]
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build
uses: docker/[email protected]
with:
context: ./docker/images/n8n
build-args: |
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and Push Docker Image
uses: docker/[email protected]
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:
- name: Create a Release on GitHub
uses: ncipollo/release-action@v1
with:
commit: ${{github.event.pull_request.base.ref}}
tag: 'n8n@${{ needs.publish-to-npm.outputs.release }}'
prerelease: true
makeLatest: false
body: ${{github.event.pull_request.body}}

create-sentry-release:
name: Create a Sentry Release
needs: [publish-to-npm, publish-to-docker-hub]
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
timeout-minutes: 5
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}

steps:
- uses: actions/[email protected]
- name: Restore cached build artifacts
uses: actions/cache/[email protected]
with:
path: ./packages/**/dist
key: ${{ github.sha }}-release:build

- name: Create a frontend release
uses: getsentry/[email protected]
continue-on-error: true
with:
projects: ${{ secrets.SENTRY_FRONTEND_PROJECT }}
version: ${{ needs.publish-to-npm.outputs.release }}
sourcemaps: packages/editor-ui/dist

- name: Create a backend release
uses: getsentry/[email protected]
continue-on-error: true
with:
projects: ${{ secrets.SENTRY_BACKEND_PROJECT }}
version: ${{ needs.publish-to-npm.outputs.release }}
sourcemaps: packages/cli/dist packages/core/dist packages/nodes-base/dist packages/@n8n/n8n-nodes-langchain/dist

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:
- name: Trigger a release note
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 }}"}'
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/n8n:${{ needs.publish-to-npm.outputs.release }}
docker.io/${{ github.repository_owner }}/n8n:${{ 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/[email protected]
# 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}}

0 comments on commit b32efbd

Please sign in to comment.