Skip to content

Commit

Permalink
ci: only build custom image on new releases
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierCane committed Dec 28, 2023
1 parent d08de67 commit f93f4ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: πŸ“¦ Build Docker image and push to Docker Hub
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:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/check-n8n-new-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: πŸ‘€ Check for new n8n stable releases
name: πŸ‘€ Check for new n8n stable releases and builds a new custom image release if needed

on:
schedule:
Expand All @@ -11,11 +11,10 @@ jobs:

timeout-minutes: 5

permissions:
contents: write

# Needed to share data between jobs. Needed to be separated jobs to reuse the build-and-push.yml workflow.
outputs:
n8n_version_to_release: ${{ steps.n8n_version.outputs.version_to_release }}
has_new_release: ${{ steps.compare_releases.outputs.has_new_release }}
version_to_release: ${{ steps.n8n_version.outputs.version_to_release }}

steps:
- name: πŸ‘€ Get the latest custom image stable release
Expand All @@ -41,23 +40,24 @@ jobs:
echo "πŸ†• Latest n8n release: ${{ steps.n8n_release.outputs.release }}"
if [ "${{ steps.custom_image_release.outputs.release }}" != "${{ steps.n8n_release.outputs.release }}" ]; then
echo "release_changed=true" >> $GITHUB_OUTPUT
echo "has_new_release=true" >> $GITHUB_OUTPUT
echo "🀩 New release detected! Releasing new custom image version in 1, 2…"
else
echo "release_changed=false" >> $GITHUB_OUTPUT
echo "has_new_release=false" >> $GITHUB_OUTPUT
echo "πŸ‘ Release has not changed. Doing nothing."
fi
- name: πŸ”‘ Remove 'n8n@' from release name to get the version
id: n8n_version
if: steps.compare_releases.outputs.release_changed == 'true'
if: steps.compare_releases.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.n8n_version_to_release }}
n8n_version: ${{ needs.check-new-release.outputs.version_to_release }}

0 comments on commit f93f4ef

Please sign in to comment.