diff --git a/.github/workflows/differ.yml b/.github/workflows/differ.yml deleted file mode 100644 index 7ebc75a..0000000 --- a/.github/workflows/differ.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Differ - -on: - workflow_run: - workflows: [Vib Build] - types: - - completed - -jobs: - differ: - runs-on: ubuntu-latest - container: - image: ghcr.io/vanilla-os/vm:main - if: github.repository == 'vanilla-os/vm-image' - - steps: - - uses: actions/checkout@v4 - - - name: Generate package diff - run: | - lpkg --unlock - PACKAGE_LIST=$(.github/gen_package_list.sh) - apt-get 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/vm/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/vm/new - lpkg --lock diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f0ecad..70c7a69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: with: fetch-depth: 0 - - uses: vanilla-os/vib-gh-action@v0.7.4 + - uses: vanilla-os/vib-gh-action@v0.8.1 with: recipe: 'recipe.yml' plugins: 'Vanilla-OS/vib-fsguard:v1.5.3' diff --git a/.github/workflows/vib-build.yml b/.github/workflows/vib-build.yml index a893375..387d5bd 100644 --- a/.github/workflows/vib-build.yml +++ b/.github/workflows/vib-build.yml @@ -3,7 +3,7 @@ name: Vib Build on: push: branches: - - 'main' + - 'dev' tags: - '*' workflow_dispatch: @@ -18,6 +18,7 @@ jobs: steps: - name: Verify Base Image Integrity + if: ${{ github.ref_type == 'tag' }} run: gh attestation verify oci://ghcr.io/vanilla-os/desktop:main --owner Vanilla-OS env: @@ -25,7 +26,7 @@ jobs: build: runs-on: ubuntu-latest - needs: verify-image + needs: [verify-image] permissions: contents: write # Allow actions to create release packages: write # Allow pushing images to GHCR @@ -35,7 +36,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: vanilla-os/vib-gh-action@v0.7.4 + - name: Change tag in recipe + if: ${{ github.ref_type == 'tag' }} + run: | + sed 's/ghcr.io\/vanilla-os\/desktop:dev/ghcr.io\/vanilla-os\/desktop:main/' -i recipe.yml + + - uses: vanilla-os/vib-gh-action@v0.8.1 with: recipe: 'recipe.yml' plugins: 'Vanilla-OS/vib-fsguard:v1.5.3' @@ -51,6 +57,16 @@ jobs: echo "REPO_OWNER_LOWERCASE=$REPO_OWNER_LOWERCASE" >> "$GITHUB_ENV" echo "IMAGE_URL=ghcr.io/$REPO_OWNER_LOWERCASE/vm" >> "$GITHUB_ENV" + - name: Extra image tag branch + if: ${{ github.ref_type != 'tag' }} + run: | + echo "EXTRA_TAG=ref,event=branch" >> "$GITHUB_ENV" + + - name: Extra image tag release + if: ${{ github.ref_type == 'tag' }} + run: | + echo "EXTRA_TAG=raw,main" >> "$GITHUB_ENV" + - name: Docker meta id: docker_meta uses: docker/metadata-action@v5 @@ -62,7 +78,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{raw}} type=semver,pattern=v{{major}} - type=ref,event=branch + type=${{ env.EXTRA_TAG }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -97,3 +113,29 @@ jobs: subject-name: ${{ env.IMAGE_URL }} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: false + + differ: + runs-on: ubuntu-latest + container: + image: ghcr.io/vanilla-os/vm:main + if: github.repository == 'vanilla-os/vm-image' && github.ref_type == 'tag' + needs: build + + steps: + - uses: actions/checkout@v4 + + - name: Generate package diff + run: | + lpkg --unlock + PACKAGE_LIST=$(.github/gen_package_list.sh) + apt-get 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/vm/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/vm/new + lpkg --lock diff --git a/recipe.yml b/recipe.yml index fe66e67..e452636 100644 --- a/recipe.yml +++ b/recipe.yml @@ -2,7 +2,7 @@ name: Vanilla Desktop VM id: vm stages: - id: build - base: ghcr.io/vanilla-os/desktop:main + base: ghcr.io/vanilla-os/desktop:dev singlelayer: false labels: maintainer: Vanilla OS Contributors