Skip to content

Commit

Permalink
ci: Automate more of the release process (no-changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Aug 20, 2024
1 parent eecb804 commit e30a853
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 59 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci-postgres-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name: Test Postgres and MySQL schemas
on:
schedule:
- cron: '0 0 * * *'
workflow_call:
inputs:
cacheKey:
description: Cache key for modules and build artifacts.
required: false
default: ''
type: string
workflow_dispatch:
pull_request:
paths:
Expand All @@ -17,6 +24,7 @@ jobs:
build:
name: Install & Build
runs-on: ubuntu-latest
if: ${{ inputs.cacheKey == '' }}
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
Expand Down Expand Up @@ -62,7 +70,7 @@ jobs:
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests
key: ${{ inputs.cacheKey != '' && inputs.cacheKey || format('{0}:db-tests', github.sha) }}

- name: Test SQLite Pooled
working-directory: packages/cli
Expand Down Expand Up @@ -91,7 +99,7 @@ jobs:
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests
key: ${{ inputs.cacheKey != '' && inputs.cacheKey || format('{0}:db-tests', github.sha) }}

- name: Start MySQL
uses: isbang/compose-action@v2.0.0
Expand Down Expand Up @@ -128,7 +136,7 @@ jobs:
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests
key: ${{ inputs.cacheKey != '' && inputs.cacheKey || format('{0}:db-tests', github.sha) }}

- name: Start Postgres
uses: isbang/compose-action@v2.0.0
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/docker-images.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/release-pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build, unit test and lint branch

on:
pull_request:
types:
- opened
branches:
- 'release/*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: pnpm
- run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Run typecheck
run: pnpm typecheck

- name: Cache build artifacts
uses: actions/cache/save@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}-base:build

db-test:
name: DB tests
uses: ./.github/workflows/ci-postgres-mysql.yml
needs: build
with:
cacheKey: ${{ github.sha }}-base:build

e2e-tests:
name: E2E Tests
uses: ./.github/workflows/e2e-reusable.yml
with:
cacheKey: ${{ github.sha }}-base:build
secrets:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
70 changes: 63 additions & 7 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ on:
- 'release/*'

jobs:
publish-release:
publish-to-npm:
name: Publish to NPM
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

timeout-minutes: 60
timeout-minutes: 10
env:
NPM_CONFIG_PROVENANCE: true

Expand Down Expand Up @@ -51,6 +47,66 @@ jobs:
pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc --no-git-checks
npm dist-tag rm n8n rc
publish-to-docker-hub:
name: Publish to DockerHub
needs: [publish-to-npm]
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
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: Set release version in env
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 }}
create-github-release:
name: Create a GitHub Release
needs: [publish-to-npm, publish-to-docker-hub]
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
contents: write
id-token: write

steps:
- name: Create a Release on GitHub
uses: ncipollo/release-action@v1
with:
Expand Down

0 comments on commit e30a853

Please sign in to comment.