Skip to content

Commit

Permalink
p
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Aug 20, 2024
1 parent e747ce0 commit 3e0cace
Showing 1 changed file with 67 additions and 57 deletions.
124 changes: 67 additions & 57 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,25 @@ 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: Build
# run: pnpm build

- name: Dry-run publishing
run: pnpm publish -r --no-git-checks --dry-run
# - name: Dry-run publishing
# run: pnpm publish -r --no-git-checks --dry-run

- name: Publish to NPM
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
node .github/scripts/trim-fe-packageJson.js
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
# - name: Publish to NPM
# run: |
# echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
# node .github/scripts/trim-fe-packageJson.js
# 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

- run: echo "Fake publish to NPM ${{ env.RELEASE }}"

- id: set-release-output
run: echo "::set-output name=release::${{ env.RELEASE }}"

publish-to-docker-hub:
name: Publish to DockerHub
Expand All @@ -66,34 +71,33 @@ jobs:
- 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 }}

- uses: actions/setup-node@v4.0.2
- run: echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> $GITHUB_ENV

- name: Build
uses: docker/build-push-action@v5.1.0
with:
context: ./docker/images/n8n
build-args: |
N8N_VERSION=${{ env.RELEASE }}
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/n8n:${{ env.RELEASE }}
ghcr.io/${{ github.repository_owner }}/n8n:${{ env.RELEASE }}
# - 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 }}

- run: echo "Fake publish to Dockerhub ${{ needs.publish-to-npm.outputs.release }}"

create-github-release:
name: Create a GitHub Release
Expand All @@ -107,28 +111,34 @@ jobs:
id-token: write

steps:
- uses: actions/setup-node@v4.0.2
- run: echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> $GITHUB_ENV

- name: Create a Release on GitHub
uses: ncipollo/release-action@v1
with:
commit: ${{github.event.pull_request.base.ref}}
tag: 'n8n@${{env.RELEASE}}'
tag: 'n8n@${{ needs.publish-to-npm.outputs.release }}'
prerelease: true
makeLatest: false
body: ${{github.event.pull_request.body}}

- name: Trigger a release note
continue-on-error: true
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":"${{env.RELEASE}}"}'

# - name: Merge Release into 'master'
# run: |
# git fetch origin
# git checkout --track origin/master
# git config user.name "Jan Oberhauser"
# git config user.email jan.oberhauser@gmail.com
# git merge --ff n8n@${{env.RELEASE}}
# git push origin master
# git push origin :${{github.event.pull_request.base.ref}}
# trigger-release-note:
# name: Trigger a release note
# needs: [publish-to-npm, create-github-release]
# runs-on: ubuntu-latest
# steps:
# - name: Trigger a release note
# continue-on-error: true
# 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]
runs-on: ubuntu-latest
steps:
- run: |
git fetch origin
git checkout --track origin/master
git config user.name "Jan Oberhauser"
git config user.email jan.oberhauser@gmail.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 3e0cace

Please sign in to comment.