-
Notifications
You must be signed in to change notification settings - Fork 6
191 lines (155 loc) · 4.35 KB
/
release.yml
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
180
181
182
183
184
185
186
187
188
189
190
191
name: release
on:
push:
branches:
- main
tags:
- v*
env:
IMAGE: ghcr.io/grampelberg/kty
concurrency:
group: |-
release-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check:
uses: ./.github/workflows/check.yml
build:
permissions:
packages: write
uses: ./.github/workflows/build.yml
secrets:
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
merge:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- build
steps:
- uses: actions/checkout@v4
- name: tags
run: git fetch --prune --unshallow --tags
- name: fetch digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: buildx
uses: docker/setup-buildx-action@v3
- uses: taiki-e/install-action@v2
with:
tool: just,git-cliff
- name: get version
id: version
run: echo "version=$(just --evaluate version)" >> "${GITHUB_OUTPUT}"
- name: meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=raw,value=${{ steps.version.outputs.version }},enable=true
type=raw,value=unstable,enable={{is_default_branch}}
type=sha
- name: login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: taiki-e/install-action@just
- name: extract binary
run: just extract-from-digests
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: kty-docker-binaries
path: /tmp/bins/*
retention-days: 1
- name: push image
working-directory: /tmp/digests
run: |
cp */* .
rm -rf digests-*
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
- name: inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
helm:
runs-on: ubuntu-latest
needs:
- build
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup show active-toolchain
- uses: Swatinem/rust-cache@v2
- uses: cargo-bins/cargo-binstall@main
- uses: jdx/mise-action@v2
with:
experimental: true
- uses: actions/download-artifact@v4
with:
path: /tmp/chart
name: helm
- name: upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: just helm-upload
release:
runs-on: ubuntu-latest
needs:
- check
- merge
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
path: /tmp/binaries
pattern: kty-*
merge-multiple: true
- uses: actions/download-artifact@v4
with:
path: /tmp/chart
name: helm
- uses: taiki-e/install-action@v2
with:
tool: git-cliff
- name: changelog
if: startsWith(github.ref, 'refs/tags/')
run: git cliff -o CHANGELOG.md -l
- name: changelog
if: github.ref == 'refs/heads/main'
run: git cliff -o CHANGELOG.md -u
- name: versioned release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.RELEASE_TOKEN }}
body_path: CHANGELOG.md
files: |-
/tmp/binaries/*
- name: unstable release
uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/main'
with:
body_path: CHANGELOG.md
name: unstable
prerelease: true
tag_name: unstable
files: |-
/tmp/binaries/*
/tmp/chart/*