fix syntax #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Vib Build | |
on: | |
push: | |
branches: [ "main" ] | |
schedule: | |
- cron: '14 3 * * *' | |
workflow_dispatch: | |
env: | |
GITHUB_USER: ${{ github.actor }} | |
DIGEST_RELEASE_TAG: save-digest | |
jobs: | |
check_update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- 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: 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: 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) | |
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: env.CHECK_UPDATES && env.HAS_UPDATES == 1 | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
tag_name: "${{ env.DIGEST_RELEASE_TAG }}" | |
prerelease: true | |
name: "This keeps track of the current digest" | |
files: | | |
digest.txt | |
- name: Update was triggered manually | |
if: env.CHECK_UPDATES != true | |
run: | | |
echo "has_updates=true" >> "$GITHUB_OUTPUT" | |
hello_world: | |
runs-on: ubuntu-latest | |
needs: check_update | |
if: needs.check_update.outputs.exitcode == 0 | |
steps: | |
- name: Hello World | |
run: echo "Hello, world" | |
bye_world: | |
runs-on: ubuntu-latest | |
needs: check_update | |
if: needs.check_update.outputs.exitcode != 0 | |
steps: | |
- name: Bye World | |
run: echo "Bye, world" | |
# build: | |
# | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - uses: actions/checkout@v4 | |
# | |
# - uses: vanilla-os/vib-gh-action@v0.3.3-1 | |
# with: | |
# recipe: 'recipe.yml' | |
# plugins: 'Vanilla-OS/vib-fsguard:v1.2-1' | |
# | |
# - name: Build the Docker image | |
# run: docker image build -f Containerfile --tag ghcr.io/vanilla-os/desktop:main . | |
# | |
# # Push the image to GHCR (Image Registry) | |
# - name: Push To GHCR | |
# if: github.repository == 'vanilla-os/desktop-image' | |
# run: | | |
# docker login ghcr.io -u ${{ env.GITHUB_USER }} -p ${{ secrets.GITHUB_TOKEN }} | |
# docker image push "ghcr.io/vanilla-os/desktop:main" |