diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index d5abf1fa2652f..e74ebbf3e3943 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml deleted file mode 100644 index fe5770252b214..0000000000000 --- a/.github/workflows/docker-images.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Docker Image CI - -on: - push: - tags: - - 'n8n@*' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.1 - - - name: Get the version - id: vars - run: echo ::set-output name=tag::$(echo ${GITHUB_REF:14}) - - - 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=${{ steps.vars.outputs.tag }} - platforms: linux/amd64,linux/arm64 - provenance: false - push: true - tags: | - ${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }} - ghcr.io/${{ github.repository_owner }}/n8n:${{ steps.vars.outputs.tag }} diff --git a/.github/workflows/release-pr-checks.yml b/.github/workflows/release-pr-checks.yml new file mode 100644 index 0000000000000..4ee8697bfa982 --- /dev/null +++ b/.github/workflows/release-pr-checks.yml @@ -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 }} diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 239c18b51223e..736166c8d58af 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -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 @@ -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: