Release: Publish #222
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Release: Publish' | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 20 * * *' | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=8192' | |
| jobs: | |
| publish-to-npm: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| outputs: | |
| create: ${{ steps.check-release.outputs.create }} | |
| release: ${{ steps.get-version.outputs.release }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get Version | |
| id: get-version | |
| run: | | |
| LATEST_TAG=$(curl -s "https://api.github.com/repos/n8n-io/n8n/releases/latest" | jq -r .tag_name) | |
| if [ -z "${LATEST_TAG}" ] || [ "${LATEST_TAG}" == "null" ]; then | |
| echo "Failed to get version" | |
| exit 1 | |
| fi | |
| # [email protected], get 1.91.3 | |
| N8N_VERSION=$(echo "${LATEST_TAG}" | cut -d "@" -f 2) | |
| echo "release=${N8N_VERSION}" >> $GITHUB_OUTPUT | |
| echo "N8N_VERSION=${N8N_VERSION}" >> $GITHUB_ENV | |
| echo "" | |
| echo "========== Build Args ==========" | |
| echo "N8N_VERSION=${N8N_VERSION}" | |
| - name: Check Release | |
| id: check-release | |
| run: | | |
| gh release view n8n@${N8N_VERSION} -R ${{ github.repository }} >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-to-docker-hub: | |
| name: Publish to DockerHub | |
| needs: [publish-to-npm] | |
| runs-on: ubuntu-latest | |
| if: needs.publish-to-npm.outputs.create == '1' | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: n8n-io/n8n | |
| ref: 'n8n@${{ needs.publish-to-npm.outputs.release }}' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: | | |
| pnpm install --frozen-lockfile | |
| - name: Build n8n for Docker | |
| run: | | |
| pnpm build:n8n | |
| sed -i 's@FROM n8nio@FROM ghcr.io/${{ github.repository_owner }}/n8nio@g' docker/images/n8n/Dockerfile | |
| sed -i 's@FROM alpine@FROM ghcr.io/${{ github.repository_owner }}/alpine@g' docker/images/n8n/Dockerfile docker/images/runners/Dockerfile | |
| sed -i 's@FROM node@FROM ghcr.io/loong64/node@g' docker/images/runners/Dockerfile | |
| sed -i 's@FROM python@FROM ghcr.io/loong64/python@g' docker/images/runners/Dockerfile | |
| sed -i '/RUN uv venv/i\ENV UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/65746188/packages/pypi/simple' docker/images/runners/Dockerfile | |
| sed -i 's@arm64@loong64@g' docker/images/n8n/Dockerfile docker/images/runners/Dockerfile | |
| sed -i 's@aarch64@loongarch64@g' docker/images/runners/Dockerfile | |
| sed -i 's@https://github.com/n8n-io@https://github.com/loong64@g' docker/images/n8n/Dockerfile docker/images/runners/Dockerfile | |
| sed -i 's@https://github.com/astral-sh@https://github.com/loong64@g' docker/images/n8n/Dockerfile docker/images/runners/Dockerfile | |
| sed -i 's@npm rebuild sqlite3@npm rebuild sqlite3 --sqlite3_binary_host=https://github.com/loong64/node-sqlite3/releases/download@g' docker/images/n8n/Dockerfile | |
| sed -i 's/rm -rf \/tmp\/uv/& \&\& ln -s \/usr\/lib\/libgcc_s.so.1 \/usr\/lib\/libgcc_s-c0abacde.so.1/' docker/images/runners/Dockerfile | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push n8n Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/images/n8n/Dockerfile | |
| build-args: | | |
| N8N_VERSION=${{ needs.publish-to-npm.outputs.release }} | |
| N8N_RELEASE_TYPE=stable | |
| platforms: linux/loong64 | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/n8nio/n8n:${{ needs.publish-to-npm.outputs.release }} | |
| - name: Build and push task runners Docker image (Alpine) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/images/runners/Dockerfile | |
| build-args: | | |
| N8N_VERSION=${{ needs.publish-to-npm.outputs.release }} | |
| N8N_RELEASE_TYPE=stable | |
| platforms: linux/loong64 | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/n8nio/runners:${{ 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: needs.publish-to-npm.outputs.create == '1' | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create a Release on GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: n8n@${{ needs.publish-to-npm.outputs.release }} | |
| tag_name: n8n@${{ needs.publish-to-npm.outputs.release }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |