Repository navigation
214 lines (189 loc) · 7.26 KB
/
Copy pathrelease-tag.yaml
File metadata and controls
214 lines (189 loc) · 7.26 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
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
214
name: Build
concurrency:
group: "${{ github.repository }}${{ github.ref }}-release"
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
name: Build
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }} # macOS is used for macOS notarization
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.23.1
cache: true
- name: Install dependencies
if: matrix.os == 'macos-latest'
run: |-
brew install coreutils
brew install mitchellh/gon/gon
- name: Import Code-Signing Certificates
if: matrix.os == 'macos-latest'
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.P12_PASSWORD }}
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |-
sudo apt install -y coreutils
- uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser-pro
version: latest
args: release --clean --split
env:
GITHUB_TOKEN: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
CGO_ENABLED: "1"
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
path: dist/linux
name: linux-${{ env.sha_short }}
- uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
path: dist/darwin
name: darwin-${{ env.sha_short }}
- uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
path: dist/windows
name: windows-${{ env.sha_short }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.23.1
cache: true
- name: GCP auth
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.B64_GCLOUD_SERVICE_ACCOUNT_JSON }}
# copy the caches from prepare
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
path: dist/linux
name: linux-${{ env.sha_short }}
- uses: actions/download-artifact@v4
with:
path: dist/darwin
name: darwin-${{ env.sha_short }}
- uses: actions/download-artifact@v4
with:
path: dist/windows
name: windows-${{ env.sha_short }}
- name: Fix goreleaser artifact paths
run: |-
sed -i -E "s/(\"path\": \")(.*)otterize-cli\/dist/\1\/home\/runner\/work\/otterize-cli\/otterize-cli\/dist/g" dist/linux/artifacts.json
sed -i -E "s/(\"path\": \")(.*)otterize-cli\/dist/\1\/home\/runner\/work\/otterize-cli\/otterize-cli\/dist/g" dist/darwin/artifacts.json
sed -i -E "s/(\"path\": \")(.*)otterize-cli\/dist/\1\/home\/runner\/work\/otterize-cli\/otterize-cli\/dist/g" dist/windows/artifacts.json
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
# release
- uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
args: continue --merge
env:
GITHUB_TOKEN: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
# This next bit checks out the homebrew repo
# and updates the formula to the latest version.
# For macOS, we need to modify the hashes for the zips ot match
# those of the notarized ZIPs, rather than the build output zips.
- name: Checkout homebrew-otterize
uses: actions/checkout@v4
with:
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
repository: otterize/homebrew-otterize
path: ./homebrew-otterize
update-docs:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout docs
uses: actions/checkout@v4
with:
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
repository: otterize/docs
path: ./docs
- name: Update docs
run: |-
cd ./docs
# Find a line with get.otterize.com split by "/" and take the 5th part that contains the version
LAST_TAG=`cat docs/_common/install-otterize-cli.md | grep get.otterize.com | head -n 1 | awk -F '/' '{print $5}'`
sed -i.bak "s/$LAST_TAG/${{ github.ref_name }}/g" docs/_common/install-otterize-cli.md
git config --global user.name "otterizebot"
git config --global user.email "otterizebot@users.noreply.github.com"
git add ./docs/_common/install-otterize-cli.md
git commit -m 'Update otterize-cli version to ${{ github.ref_name }}'
git push origin main
update-mapper-readme:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout docs
uses: actions/checkout@v4
with:
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
repository: otterize/network-mapper
path: ./network-mapper
- name: Update readme
run: |-
cd ./network-mapper
# Find a line with get.otterize.com split by "/" and take the 5th part that contains the version
LAST_TAG=`cat README.md | grep get.otterize.com | head -n 1 | awk -F '/' '{print $5}'`
sed -i.bak "s/$LAST_TAG/${{ github.ref_name }}/g" README.md
git config --global user.name "otterizebot"
git config --global user.email "otterizebot@users.noreply.github.com"
git add README.md
git commit -m 'Update otterize-cli version to ${{ github.ref_name }}'
git push origin main
update-cli-readme:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout CLI
uses: actions/checkout@v4
with:
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
path: ./cli
ref: main
- name: Update readme
run: |-
cd ./cli
# Find a line with get.otterize.com split by "/" and take the 5th part that contains the version
LAST_TAG=`cat README.md | grep get.otterize.com | head -n 1 | awk -F '/' '{print $5}'`
sed -i.bak "s/$LAST_TAG/${{ github.ref_name }}/g" README.md
git config --global user.name "otterizebot"
git config --global user.email "otterizebot@users.noreply.github.com"
git add README.md
git commit -m 'Update otterize-cli version to ${{ github.ref_name }}'
git push origin main