Skip to content

Commit 93be9c7

Browse files
committed
ci: GitHub Actions
1 parent 7d143bd commit 93be9c7

File tree

3 files changed

+149
-0
lines changed

3 files changed

+149
-0
lines changed

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY_USER: ${{ github.actor }}
11+
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
12+
13+
jobs:
14+
verify-image:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Verify Base Image Integrity
19+
run:
20+
gh attestation verify oci://ghcr.io/vanilla-os/pico:main --owner Vanilla-OS
21+
env:
22+
GH_TOKEN: ${{ github.token }}
23+
24+
release:
25+
runs-on: ubuntu-latest
26+
needs: verify-image
27+
permissions:
28+
contents: write
29+
attestations: write
30+
id-token: write
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- uses: vanilla-os/vib-gh-action@v0.8.1
39+
40+
- uses: actions/upload-artifact@v4
41+
with:
42+
name: Containerfile
43+
path: Containerfile
44+
45+
- name: Create Release
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: gh release create "${{ github.ref_name }}" --generate-notes Containerfile
49+
50+
- name: Attest Release Files
51+
id: attest
52+
uses: actions/attest-build-provenance@v2
53+
with:
54+
subject-path: 'Containerfile'

.github/workflows/vib-build.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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

includes.container/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)