From 8590776a37e6b5f6122a0cdc557840cbcfbaa2fa Mon Sep 17 00:00:00 2001 From: Phillip Schichtel Date: Wed, 4 Oct 2023 23:48:42 +0200 Subject: [PATCH] build everything in one workflow --- .github/workflows/build-images.yml | 11 ++++++++++- .github/workflows/fetch-versions.yml | 25 ------------------------- build-images.sh | 9 +++++++-- fetch-versions.sh | 4 +++- 4 files changed, 20 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/fetch-versions.yml diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 7f53868..6e5fc7d 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -1,5 +1,8 @@ -name: Build Image +# This is a basic workflow to help you get started with Actions +name: Fetch Sponge Versions + +# Controls when the action will run. on: push: branches: @@ -9,11 +12,16 @@ on: - recommended-versions.json - Dockerfile - build-images.sh + - fetch-versions.sh + - .github/workflows/* + schedule: + - cron: '0 0 * * *' workflow_dispatch: jobs: build: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - name: Login to GitHub Container Registry @@ -24,3 +32,4 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push run: ./build-images.sh + diff --git a/.github/workflows/fetch-versions.yml b/.github/workflows/fetch-versions.yml deleted file mode 100644 index d7ceaca..0000000 --- a/.github/workflows/fetch-versions.yml +++ /dev/null @@ -1,25 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Fetch Sponge Versions - -# Controls when the action will run. -on: - schedule: - # * is a special character in YAML so you have to quote this string - - cron: '0 0 * * *' - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - fetch-versions: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - uses: actions/checkout@v3 - - name: Fetch Versions - run: ./fetch-versions.sh - diff --git a/build-images.sh b/build-images.sh index fa87aa5..dce4b0a 100755 --- a/build-images.sh +++ b/build-images.sh @@ -43,5 +43,10 @@ build_images() { done } -build_images latest -build_images recommended +if ./fetch-versions.sh +then + build_images latest + build_images recommended +else + echo "Nothing changed, nothing to build!" +fi diff --git a/fetch-versions.sh b/fetch-versions.sh index c19473f..fa1fa63 100755 --- a/fetch-versions.sh +++ b/fetch-versions.sh @@ -37,10 +37,12 @@ git config user.email 'no-reply@cubeengine.org' git add "$latest_versions_file" "$recommended_versions_file" -if git commit -m 'My hands are typing words....' +if git commit -m 'My hands are still typing words....' then git push + exit 0 else echo "No new versions!" + exit 1 fi