-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (65 loc) · 2.27 KB
/
build-and-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 }}"
}