-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (90 loc) · 3.03 KB
/
Copy pathrelease.yml
File metadata and controls
103 lines (90 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: release
on:
push:
tags: ['v*.*.*']
workflow_dispatch:
permissions:
contents: read
packages: write
id-token: write # for cosign keyless signing
env:
GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/ubuntu-desktop
DOCKERHUB_IMAGE: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/ubuntu-desktop
jobs:
release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
variant: [full, slim]
steps:
- uses: actions/checkout@v6
- name: Read VERSION
id: version
run: echo "value=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Compute tags
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_IMAGE }}
${{ env.DOCKERHUB_IMAGE }}
flavor: |
suffix=${{ matrix.variant == 'slim' && '-slim' || '' }},onlatest=true
latest=${{ matrix.variant == 'full' }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=24.04,enable=${{ matrix.variant == 'full' }}
labels: |
org.opencontainers.image.version=${{ steps.version.outputs.value }}
- name: Build & push (multi-arch)
id: build
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VARIANT=${{ matrix.variant }}
INCLUDE_BROWSER=${{ matrix.variant == 'full' }}
INCLUDE_MEDIA=${{ matrix.variant == 'full' }}
INCLUDE_VSCODE=${{ matrix.variant == 'full' }}
INCLUDE_DEVTOOLS=true
provenance: mode=max
sbom: true
cache-from: type=gha,scope=${{ matrix.variant }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
- name: Install cosign
uses: sigstore/cosign-installer@v3
- name: Sign images (keyless)
env:
DIGEST: ${{ steps.build.outputs.digest }}
TAGS: ${{ steps.meta.outputs.tags }}
run: |
for tag in ${TAGS}; do
cosign sign --yes "${tag}@${DIGEST}"
done
- name: Trivy scan (gate)
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: ${{ env.GHCR_IMAGE }}@${{ steps.build.outputs.digest }}
severity: CRITICAL
exit-code: '1'
ignore-unfixed: true