diff --git a/.github/workflows/vib-build.yml b/.github/workflows/vib-build.yml index aea8195..68dc447 100644 --- a/.github/workflows/vib-build.yml +++ b/.github/workflows/vib-build.yml @@ -41,17 +41,10 @@ jobs: jq -r '.image.releases[-1].digest' vanilla-image-info > digest.txt echo Old digest is: $(cat last_digest.txt) echo New digest is: $(cat digest.txt) - if [ $(cmp -s digest.txt last_digest.txt) ]; then - echo base image was updated since last build - echo "HAS_UPDATES=true" >> "$GITHUB_ENV" - echo "has_updates=true" >> "$GITHUB_OUTPUT" - else - echo no updates to the base image since last build - echo "has_updates=false" >> "$GITHUB_OUTPUT" - fi + echo "HAS_UPDATES=$(cmp -s digest.txt last_digest.txt)" >> "$GITHUB_ENV" - name: Upload new digest - if: env.CHECK_UPDATES && env.HAS_UPDATES == 1 + if: env.CHECK_UPDATES && env.HAS_UPDATES uses: softprops/action-gh-release@v1 with: token: "${{ secrets.GITHUB_TOKEN }}" @@ -61,23 +54,29 @@ jobs: files: | digest.txt - - name: Update was triggered manually - if: env.CHECK_UPDATES != true + - name: Set output run: | - echo "has_updates=true" >> "$GITHUB_OUTPUT" + if [ ${{ env.HAS_UPDATES }} ] + then + echo base image was updated since last build + echo "has_updates=true" >> "$GITHUB_OUTPUT" + else + echo no updates to the base image since last build + echo "has_updates=false" >> "$GITHUB_OUTPUT" + fi - hello_world: + update: runs-on: ubuntu-latest needs: check_update - if: needs.check_update.outputs.exitcode == 0 + if: needs.check_update.outputs.has_updates == true steps: - name: Hello World run: echo "Hello, world" - bye_world: + dont_update: runs-on: ubuntu-latest needs: check_update - if: needs.check_update.outputs.exitcode != 0 + if: needs.check_update.outputs.has_updates != true steps: - name: Bye World run: echo "Bye, world"