-
Notifications
You must be signed in to change notification settings - Fork 122
179 lines (154 loc) · 5.06 KB
/
release.yaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
name: Release
on:
push:
tags:
- v*
jobs:
releaseBinaries:
name: Release Binaries
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go and restore cached dependencies
uses: ./.github/actions/setup-go
with:
cross_compiling: true
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/cerbos/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --config=.goreleaser.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
TELEMETRY_WRITE_KEY: ${{ secrets.TELEMETRY_WRITE_KEY }}
TELEMETRY_URL: ${{ secrets.TELEMETRY_URL }}
releaseProtos:
name: Release Protobufs
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1.19.0
with:
github_token: ${{ github.token }}
- name: Push public API to BSR
uses: bufbuild/buf-push-action@v1.1.1
with:
buf_token: ${{ secrets.BUF_TOKEN }}
input: api/public
- name: Push private API to BSR
uses: bufbuild/buf-push-action@v1.1.1
with:
buf_token: ${{ secrets.BUF_TOKEN }}
input: api/private
releaseJSONSchemas:
name: Release JSON schemas
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
id-token: write
contents: read
steps:
- name: Check out code
uses: actions/checkout@v3
- name: GCloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY}}
- name: Install Cloud SDK
uses: google-github-actions/setup-gcloud@v1.1.1
- name: Publish JSON schemas
run: |-
VERSION="${GITHUB_REF#refs/tags/}"
GCS_BUCKET="${{ secrets.API_GCS_BUCKET }}"
hack/scripts/publish-json-schemas.sh "${VERSION}" "${GCS_BUCKET}"
gsutil -m rsync -d -r "gs://${GCS_BUCKET}/${VERSION}" "gs://${GCS_BUCKET}/latest"
releaseDocs:
name: Release Documentation
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
lfs: true
- name: Generate docs
uses: ./.github/actions/antora-docs
id: docs
- name: Publish to Netlify
uses: netlify/actions/cli@master
with:
args: deploy --prod
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
publishHelm:
name: Publish Helm chart
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
id-token: write
contents: read
env:
CHARTS_DIR: deploy/out/helm-charts
OCI_REGISTRY: ghcr.io/cerbos/helm-charts
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Helm
uses: azure/setup-helm@v3.5
- name: GCloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY}}
- name: Install Cloud SDK
uses: google-github-actions/setup-gcloud@v1.1.1
- name: Package Helm chart
run: |-
mkdir -p ${{ env.CHARTS_DIR }}/cerbos
helm package -d ${{ env.CHARTS_DIR }}/cerbos deploy/charts/cerbos
- name: Publish to download site
run: |-
gsutil cp "gs://${{ secrets.DOWNLOAD_GCS_BUCKET }}/helm-charts/index.yaml" "${{ env.CHARTS_DIR }}/index.yaml"
helm repo index --url=https://download.cerbos.dev/helm-charts --merge=${{ env.CHARTS_DIR }}/index.yaml ${{ env.CHARTS_DIR }}
gsutil rsync -r ${{ env.CHARTS_DIR }}/ "gs://${{ secrets.DOWNLOAD_GCS_BUCKET }}/helm-charts/"
- name: Publish to OCI registry
run: |-
helm registry login ${{ env.OCI_REGISTRY }} -u ${{ secrets.HELM_CHARTS_REPO_USER }} -p ${{ secrets.HELM_CHARTS_REPO_TOKEN }}
CHART=$(ls ${{ env.CHARTS_DIR }}/cerbos/*.tgz); helm push $CHART oci://${{ env.OCI_REGISTRY }}
helm registry logout ${{ env.OCI_REGISTRY }}
env:
HELM_EXPERIMENTAL_OCI: '1'