Skip to content

Commit

Permalink
fix conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
taukakao committed Jan 30, 2024
1 parent 7f9c0d8 commit ccc49bf
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/vib-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,38 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set requirement
run: echo "CHECK_UPDATES=${{ github.event_name != 'schedule'}}" >> "$GITHUB_ENV"

- name: Install dependencies
if: env.CHECK_UPDATES
run: sudo apt-get install jq

- name: Download previous digest
if: github.event_name != 'schedule'
if: env.CHECK_UPDATES
continue-on-error: true
run: wget https://github.com/${{ github.repository }}/releases/download/${{ env.DIGEST_RELEASE_TAG }}a/digest.txt

- name: Check if there was an update to the base image
if: github.event_name != 'schedule'
if: env.CHECK_UPDATES
run: |
touch digest.txt
mv digest.txt last_digest.txt
curl https://differ.vanillaos.org/images/desktop > vanilla-image-info
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)
cmp -s digest.txt last_digest.txt
echo "HAS_UPDATES=$?" >> "$GITHUB_ENV"
if [ ${{ env.HAS_UPDATES }} ]; then
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
- name: Upload new digest
if: github.event_name != 'schedule' && env.HAS_UPDATES == 1
if: env.CHECK_UPDATES && env.HAS_UPDATES == 1
uses: softprops/action-gh-release@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
Expand All @@ -59,7 +62,7 @@ jobs:
digest.txt
- name: Update was triggered manually
if: github.event_name == 'schedule'
if: !env.CHECK_UPDATES
run: |
echo "has_updates=true" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit ccc49bf

Please sign in to comment.