π¦ Build custom Docker image and push to Docker Hub #15
This file contains 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: π¦ Build custom Docker image and push to Docker Hub | |
# Workflow triggered manually (GitHub UI) or programmatically by the check-n8n-new-release workflow | |
on: | |
workflow_call: | |
inputs: | |
n8n_version: | |
description: 'n8n version to build. Example: 1.20.0' | |
required: true | |
type: string | |
workflow_dispatch: | |
inputs: | |
n8n_version: | |
description: 'n8n version to build. Example: 1.20.0' | |
required: true | |
type: string | |
jobs: | |
build-push-docker-image: | |
name: π³ Build and push Docker image | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: docker/build-push-action@v5 | |
with: | |
context: . | |
build-args: N8N_VERSION=${{ inputs.n8n_version }} | |
push: true | |
tags: codelytvtech/n8n-custom-image:${{ inputs.n8n_version }} | |
create-release: | |
name: π·οΈ Create GitHub Release | |
needs: build-push-docker-image | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
permissions: | |
contents: write | |
steps: | |
- uses: ncipollo/release-action@v1 | |
with: | |
commit: main | |
tag: n8n@${{ inputs.n8n_version }} | |
notify-new-release: | |
# It would be great to have this as a separate workflow triggered by the release event, | |
# but GitHub Actions does not execute workflows if the release has been generated by another workflow. | |
# Reference: https://github.com/orgs/community/discussions/25281 | |
# The only alternative would be executing it with a workflow_call trigger, | |
# but taking into account that this is the single time we would be doing so, it would be a little overkill. | |
name: π¬ Notify new image release in Slack | |
needs: build-push-docker-image | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- uses: slackapi/slack-github-action@v1 | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.RELEASE_NOTIFICATION__SLACK_WEBHOOK_URL }} | |
with: | |
payload: | | |
{ | |
"n8n_version": "${{ inputs.n8n_version }}" | |
} | |