-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (74 loc) · 2.51 KB
/
build-and-publish.yaml
File metadata and controls
86 lines (74 loc) · 2.51 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
---
name: Build Desktop Image
on:
push:
branches:
- main
schedule:
- cron: "0 14 * * *"
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # needed for signing the images with GitHub OIDC Token
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Check current branch
if: github.ref != 'refs/heads/main'
run: exit 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./images/desktop/Containerfile
context: ./images/desktop
image: ghcr.io/frzifus/desktop
tags: latest
archs: amd64 # disable, arm64
oci: false
- id: docker_meta
uses: docker/metadata-action@v6.0.0
with:
images: ${{ steps.build_image.outputs.image }}
tags: type=sha,format=long,type=ref,event=branch
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
id: registry_login
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
id: push
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ghcr.io
- name: Install Cosign
uses: sigstore/cosign-installer@v4.1.1
- name: Sign the images with GitHub OIDC Token
env:
IMAGE: ${{ steps.build_image.outputs.image }}
DIGEST: ${{ steps.push.outputs.digest }}
TAGS: ${{ steps.docker_meta.outputs.tags }}
run: cosign sign --yes ${IMAGE}@${DIGEST}
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
# - name: Sign image with a key
# run: |
# images=""
# for tag in ${TAGS}; do
# images+="${tag}@${DIGEST} "
# done
# cosign sign --yes --key env://COSIGN_PRIVATE_KEY ${images}
# env:
# TAGS: ${{ steps.docker_meta.outputs.tags }}
# COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
# COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
# DIGEST: ${{ steps.build-and-push.outputs.digest }}