Skip to content

Commit

Permalink
fu: make differ run as job only on tags
Browse files Browse the repository at this point in the history
Signed-off-by: K.B.Dharun Krishna <[email protected]>
  • Loading branch information
kbdharun authored and taukakao committed Nov 6, 2024
1 parent 95d9fcf commit 418da75
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 37 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/differ.yml

This file was deleted.

37 changes: 31 additions & 6 deletions .github/workflows/vib-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ on:
env:
BUILDX_NO_DEFAULT_ATTESTATIONS: 1

permissions:
contents: write # Allow actions to create release
packages: write # Allow pushing images to GHCR
attestations: write # To create and write attestations
id-token: write # Additional permissions for the persistence of the attestations

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # Allow actions to create release
packages: write # Allow pushing images to GHCR
attestations: write # To create and write attestations
id-token: write # Additional permissions for the persistence of the attestations

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -119,6 +118,7 @@ jobs:
path: rootfs/vanilla-pico.tar.zst

- uses: softprops/action-gh-release@v2
if: ${{ github.event_name != 'pull_request' }}
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "continuous"
Expand All @@ -127,3 +127,28 @@ jobs:
files: |
rootfs/vanilla-pico.tar.gz
rootfs/checksum.txt
differ:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.repository == 'vanilla-os/pico-image'
needs: build
container:
image: ghcr.io/vanilla-os/pico:main

steps:
- uses: actions/checkout@v4

- name: Generate package diff
run: |
PACKAGE_LIST=$(.github/gen_package_list.sh)
apt install -f -y
apt install -y curl
IMAGE_DIGEST=$(curl -s -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/Vanilla-OS/packages/container/pico/versions | grep -m1 name | sed -E 's/^\s*"name": "(.+)".*$/\1/')
curl -X POST \
-H 'Accept:application/json' \
-H "Authorization:Basic $(echo -n "${{ secrets.DIFFER_USER }}:${{ secrets.DIFFER_PSW }}" | base64)" \
-d "{\"digest\":\"${IMAGE_DIGEST}\",${PACKAGE_LIST}}" \
${{ vars.DIFFER_URL }}/images/pico/new

0 comments on commit 418da75

Please sign in to comment.