This repository was archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
121 lines (106 loc) · 4.32 KB
/
release.yml
File metadata and controls
121 lines (106 loc) · 4.32 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: 'tag of the draft release'
required: true
type: string
env:
workload_identity_provider: 'projects/985030810135/locations/global/workloadIdentityPools/github/providers/github'
service_account: 'githubaction@mirrosa.iam.gserviceaccount.com'
key: 'gcpkms://projects/mirrosa/locations/us/keyRings/signing/cryptoKeys/mirrosa'
jobs:
fetch_public_key:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Install Cosign'
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- name: 'Authenticate to GCP'
uses: google-github-actions/auth@8254fb75a33b976a221574d287e93919e6a36f70 # v2.1.6
with:
workload_identity_provider: ${{ env.workload_identity_provider }}
service_account: ${{ env.service_account }}
- name: 'Sign'
run: cosign public-key --key $key --outfile signing.pub
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: 'signing.pub'
path: 'signing.pub'
retention-days: 1
build_and_sign:
needs: 'fetch_public_key'
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
strategy:
matrix:
goarch:
- 'amd64'
- 'arm64'
goos:
- 'darwin'
- 'linux'
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Set up Go'
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: '1.23'
check-latest: true
cache: true
- name: 'Build'
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o mirrosa_${{ matrix.goos }}_${{ matrix.goarch }} .
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}
path: mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}
retention-days: 1
- name: 'Install Cosign'
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- name: 'Authenticate to GCP'
uses: google-github-actions/auth@8254fb75a33b976a221574d287e93919e6a36f70 # v2.1.6
with:
workload_identity_provider: ${{ env.workload_identity_provider }}
service_account: ${{ env.service_account }}
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: 'signing.pub'
- name: 'Sign'
run: |
cosign sign-blob --yes --key $key mirrosa_${{ matrix.goos }}_${{ matrix.goarch }} --output-signature mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}.sig
cosign verify-blob --key signing.pub --signature mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}.sig mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}.sig
path: mirrosa_${{ matrix.goos }}_${{ matrix.goarch }}.sig
retention-days: 1
release:
needs:
- 'fetch_public_key'
- 'build_and_sign'
permissions:
contents: 'write'
runs-on: ubuntu-latest
steps:
# If the name input parameter is not provided, all artifacts will be downloaded.
# To differentiate between downloaded artifacts, a directory denoted by the artifacts name will be created for each individual artifact.
# i.e. signing.pub will be in release_artifacts/signing.pub/signing.pub
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: 'release_artifacts'
- name: 'Release'
uses: "softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191" # v2.0.8
with:
name: "${{ inputs.tag }}"
draft: true
generate_release_notes: true
token: "${{ github.token }}"
files: |
release_artifacts/*/*