-
-
Notifications
You must be signed in to change notification settings - Fork 517
213 lines (201 loc) · 8.25 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Releases
on:
push:
tags:
# These aren't regexps. They are "Workflow Filter patterns"
- v[0-9]+.[0-9]+.[0-9]
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-test.[0-9]+
env:
TELEPRESENCE_REGISTRY: ghcr.io/telepresenceio
jobs:
build-release:
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- amd64
- arm64
exclude:
- runner: windows-latest
arch: arm64
runs-on: ${{ matrix.runner }}
env:
GOARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/install-dependencies
name: install dependencies
- name: set version
shell: bash
run: echo "TELEPRESENCE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: generate binaries
run: make release-binary
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.runner }}-${{ matrix.arch }}
path: build-output/release
retention-days: 1
push-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/install-dependencies
name: install dependencies
- name: set version
shell: bash
run: |
v=${{ github.ref_name }}
echo "TELEPRESENCE_VERSION=$v" >> "$GITHUB_ENV"
echo "TELEPRESENCE_SEMVER=${v#v}" >> "$GITHUB_ENV"
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Build image dependencies
run: make images-deps
- name: Make helm chart
run: make helm-chart
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push client image
run: |
docker buildx build --platform=linux/amd64,linux/arm64 --build-arg TELEPRESENCE_VERSION=${{env.TELEPRESENCE_SEMVER}} \
--push --tag ${{env.TELEPRESENCE_REGISTRY}}/telepresence:${{env.TELEPRESENCE_SEMVER}} -f build-aux/docker/images/Dockerfile.client .
- name: Push tel2 image
run: |
docker buildx build --platform=linux/amd64,linux/arm64 --build-arg TELEPRESENCE_VERSION=${{env.TELEPRESENCE_SEMVER}} \
--push --tag ${{env.TELEPRESENCE_REGISTRY}}/tel2:${{env.TELEPRESENCE_SEMVER}} -f build-aux/docker/images/Dockerfile.traffic .
- name: Push Helm Chart
run: helm push build-output/telepresence-chart.tgz oci://${{env.TELEPRESENCE_REGISTRY}}
- name: Log out from registry
if: always()
run: docker logout
publish-release:
runs-on: ubuntu-latest
needs:
- build-release
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Determine if version is RC, TEST, or GA
id: semver_check
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-test.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-draft.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=true" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
else
echo "make_latest=true" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create draft release
if: steps.semver_check.outputs.draft == true
uses: ncipollo/release-action@v1
with:
artifacts: "binaries-*/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft:
tag: ${{ github.ref_name }}
body: |
## Draft Release
For more information, visit our [installation docs](https://www.telepresence.io/docs/latest/quick-start/).
- name: Create release
if: steps.semver_check.outputs.draft != true
uses: ncipollo/release-action@v1
with:
artifacts: "binaries-*/*"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ steps.semver_check.outputs.prerelease }}
makeLatest: ${{ steps.semver_check.outputs.make_latest }}
tag: ${{ github.ref_name }}
body: |
## Official Release Artifacts
### Linux
- 📦 [telepresence-linux-amd64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-linux-amd64)
- 📦 [telepresence-linux-arm64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-linux-arm64)
### OSX Darwin
- 📦 [telepresence-darwin-amd64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-darwin-amd64)
- 📦 [telepresence-darwin-arm64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-darwin-arm64)
### Windows
- 📦 [telepresence-windows-amd64.zip](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-windows-amd64.zip)
For more builds across platforms and architectures, see the `Assets` section below.
And for more information, visit our [installation docs](https://www.telepresence.io/docs/quick-start/).
![Assets](https://static.scarf.sh/a.png?x-pxid=d842651a-2e4d-465a-98e1-4808722c01ab)
- name: Update Homebrew
if: needs.publish-release.semver_check.outputs.draft != true
run: |
v=${{ github.ref_name }}
packaging/homebrew-package.sh ${v#v} tel2oss
test-release:
needs:
- push-images
- publish-release
if: needs.publish-release.semver_check.outputs.draft != true
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- amd64
- arm64
exclude:
- runner: windows-latest
arch: arm64
runs-on: ${{ matrix.runner }}
steps:
- name: download binary
env:
DOWNLOAD_URL: "https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}"
shell: bash
run: |
if [ "${{ runner.os }}" = "macOS" ]; then
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-darwin-${{ matrix.arch }} -o ./telepresence || { echo "Curl command failed" ; exit 1; }
elif [ "${{ runner.os }}" = "Windows" ]; then
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-windows-${{ matrix.arch }}.zip -o ./telepresence.zip || { echo "Curl command failed" ; exit 1; }
unzip ./telepresence.zip || { echo "Unzip command failed" ; exit 1; }
else
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-linux-${{ matrix.arch }} -o ./telepresence || { echo "Curl command failed" ; exit 1; }
fi
- name: test binary
shell: bash
if: ${{ !(runner.os == 'Linux' && runner.arch == 'X64' && matrix.arch == 'arm64') }}
run: |
chmod +x ./telepresence
output=$(./telepresence version)
if [ $? -eq 0 ]; then
echo "Telepresence command executed successfully"
else
echo "Telepresence command failed"
exit 1
fi
echo "$output" | grep -q "Client\s*:\s*${{ github.ref_name }}"
if [ $? -eq 0 ]; then
echo "Version match!"
else
echo "Version does not match!"
exit 1
fi