1+ name : Vib Build
2+
3+ on :
4+ push :
5+ branches :
6+ - ' main'
7+ tags :
8+ - ' *'
9+ workflow_dispatch :
10+ pull_request :
11+
12+ env :
13+ BUILDX_NO_DEFAULT_ATTESTATIONS : 1
14+
15+ jobs :
16+ verify-image :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Verify Base Image Integrity
21+ run :
22+ gh attestation verify oci://ghcr.io/vanilla-os/pico:main --owner Vanilla-OS
23+ env :
24+ GH_TOKEN : ${{ github.token }}
25+
26+ build :
27+ runs-on : ubuntu-latest
28+ needs : verify-image
29+ permissions :
30+ contents : write
31+ packages : write
32+ attestations : write
33+ id-token : write
34+
35+ steps :
36+ - uses : actions/checkout@v4
37+ - uses : vanilla-os/vib-gh-action@v0.8.1
38+
39+ - uses : actions/upload-artifact@v4
40+ with :
41+ name : Containerfile
42+ path : Containerfile
43+
44+ - name : Generate image name
45+ run : |
46+ REPO_OWNER_LOWERCASE="$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')"
47+ echo "REPO_OWNER_LOWERCASE=$REPO_OWNER_LOWERCASE" >> "$GITHUB_ENV"
48+ echo "IMAGE_URL=ghcr.io/$REPO_OWNER_LOWERCASE/dev" >> "$GITHUB_ENV"
49+
50+ - name : Docker meta
51+ id : docker_meta
52+ uses : docker/metadata-action@v5
53+ with :
54+ images : |
55+ ${{ env. IMAGE_URL }}
56+ tags : |
57+ type=semver,pattern={{version}}
58+ type=semver,pattern={{major}}.{{minor}}
59+ type=semver,pattern={{raw}}
60+ type=semver,pattern=v{{major}}
61+ type=ref,event=branch
62+
63+ - name : Set up Docker Buildx
64+ uses : docker/setup-buildx-action@v3
65+
66+ - name : Login to GitHub Package Registry
67+ uses : docker/login-action@v3
68+ if : ${{ github.event_name != 'pull_request' }}
69+ with :
70+ registry : ghcr.io
71+ username : ${{ github.repository_owner }}
72+ password : ${{ secrets.GITHUB_TOKEN }}
73+
74+ - name : Build and Push the Docker image
75+ id : push
76+ uses : docker/build-push-action@v6
77+ with :
78+ context : .
79+ file : Containerfile
80+ push : ${{ github.event_name != 'pull_request' }}
81+ tags : ${{ steps.docker_meta.outputs.tags }}
82+ labels : ${{ steps.docker_meta.outputs.labels }}
83+ cache-from : type=gha
84+ cache-to : type=gha,mode=max
85+ platforms : linux/amd64
86+ provenance : false
87+
88+ - name : Attest pushed image
89+ uses : actions/attest-build-provenance@v2
90+ id : attest
91+ if : ${{ github.event_name != 'pull_request' }}
92+ with :
93+ subject-name : ${{ env.IMAGE_URL }}
94+ subject-digest : ${{ steps.push.outputs.digest }}
95+ push-to-registry : false
0 commit comments