-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (56 loc) · 2.7 KB
/
check-n8n-new-release.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
name: 👀 Check for new n8n stable releases and builds a new custom image release if needed
on:
schedule:
- cron: '0 8 * * *' # Every day at 8am
workflow_dispatch:
jobs:
check-new-release:
runs-on: ubuntu-latest
timeout-minutes: 5
# Output mapping needed to share data between jobs. Separated jobs to reuse the build-and-push.yml workflow.
outputs:
has_new_release: ${{ steps.new_release_check.outputs.has_new_release }}
version_to_release: ${{ steps.n8n_version.outputs.version_to_release }}
steps:
- name: 👀 Get the latest Codely n8n custom image stable release
id: custom_image_release
uses: pozetroninc/[email protected]
with:
repository: CodelyTV/n8n-codely-custom-image
excludes: prerelease,draft
token: ${{ secrets.GITHUB_TOKEN }}
- name: 🆕 Get the latest n8n stable release
id: n8n_release
uses: pozetroninc/[email protected]
with:
repository: n8n-io/n8n
excludes: prerelease,draft
token: ${{ secrets.GITHUB_TOKEN }}
- name: 🤲 Check if it is a newer n8n release
id: new_release_check
run: |
echo "👀 Latest Codely custom image release: ${{ steps.custom_image_release.outputs.release }}"
echo "🆕 Latest n8n release: ${{ steps.n8n_release.outputs.release }}"
custom_version=$(echo "${{ steps.custom_image_release.outputs.release }}" | sed 's/n8n@//g')
n8n_version=$(echo "${{ steps.n8n_release.outputs.release }}" | sed 's/n8n@//g')
latest_version=$(echo -e "$custom_version\n$n8n_version" | sort -V | tail -n1)
if [ "$custom_version" != "$latest_version" ]; then
echo "has_new_release=true" >> $GITHUB_OUTPUT
echo "🤩 New release detected! Releasing new custom image version in 1, 2…"
else
echo "has_new_release=false" >> $GITHUB_OUTPUT
echo "👍 Release has not changed or it is previous to the current one. Doing nothing."
fi
- name: 🔡 Remove 'n8n@' from release name to get the version
id: n8n_version
if: steps.new_release_check.outputs.has_new_release == 'true'
run: |
version_to_release=$(echo "${{ steps.n8n_release.outputs.release }}" | sed 's/n8n@//g')
echo "version_to_release=$version_to_release" >> $GITHUB_OUTPUT
build-and-push-new-docker-image:
needs: check-new-release
if: ${{ needs.check-new-release.outputs.has_new_release == 'true' }}
uses: ./.github/workflows/build-and-push.yml
secrets: inherit
with:
n8n_version: ${{ needs.check-new-release.outputs.version_to_release }}