-
Notifications
You must be signed in to change notification settings - Fork 28
224 lines (222 loc) · 9.23 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: release
on:
push:
tags:
- "v*"
jobs:
build-64bit-msi:
runs-on: windows-2022
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: '**/go.sum'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser-pro
version: "v1.18.2"
args: build --single-target --skip-validate --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Copy Windows Collector Binary
run: cp dist/windows_amd64/collector_windows_amd64_v1/observiq-otel-collector.exe windows/observiq-otel-collector.exe
- name: Copy Windows Updater Binary
run: cp dist/windows_amd64/updater_windows_amd64_v1/updater.exe windows/updater.exe
- name: Copy Plugins to MSI Build Directory
run: cp -r release_deps/plugins windows/
- name: Copy Example Config
run: cp config/example.yaml windows/config.yaml
- name: Copy Logging Config
run: cp config/logging.yaml windows/logging.yaml
- name: Copy JMX Receiver Jar
run: cp release_deps/opentelemetry-java-contrib-jmx-metrics.jar windows/opentelemetry-java-contrib-jmx-metrics.jar
- name: Copy LICENSE
run: cp LICENSE windows/LICENSE
- name: Copy VERSION file
run: cp release_deps/VERSION.txt windows/VERSION.txt
# HACK: Copy build directory to C drive to avoid this error, since there must be a relative path from the tempdir that go-msi uses
# for the MSI to build properly
- name: Copy Build Dir
run: |
cp -r windows C:/build
echo "C:/build" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Installs go-msi and wix.
- name: Install Build Tools
run: |
curl -f -L -o go-msi.exe https://github.com/observIQ/go-msi/releases/download/v2.2.0/go-msi.exe
curl -f -L -o wix310-binaries.zip http://wixtoolset.org/downloads/v3.10.3.3007/wix310-binaries.zip
unzip wix310-binaries.zip
working-directory: C:/build
- name: "Build MSI from Tagged Release"
run: go-msi.exe make -m observiq-otel-collector.msi --version ${{ github.ref_name }} --arch amd64
working-directory: C:/build
- name: "Upload MSI"
uses: actions/upload-artifact@v3
with:
name: observiq-otel-collector.msi
path: C:/build/observiq-otel-collector.msi
# Short lived because Go Releaser will upload the msi to a release (github release, gcs, etc)
retention-days: 1
build-32bit-msi:
runs-on: windows-2022
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: '**/go.sum'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser-pro
version: "v1.18.2"
args: build --single-target --skip-validate --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GOARCH: "386"
- name: Copy Windows Collector Binary
run: cp dist/windows_386/collector_windows_386/observiq-otel-collector.exe windows/observiq-otel-collector.exe
- name: Copy Windows Updater Binary
run: cp dist/windows_386/updater_windows_386/updater.exe windows/updater.exe
- name: Copy Plugins to MSI Build Directory
run: cp -r release_deps/plugins windows/
- name: Copy Example Config
run: cp config/example.yaml windows/config.yaml
- name: Copy Logging Config
run: cp config/logging.yaml windows/logging.yaml
- name: Copy JMX Receiver Jar
run: cp release_deps/opentelemetry-java-contrib-jmx-metrics.jar windows/opentelemetry-java-contrib-jmx-metrics.jar
- name: Copy LICENSE
run: cp LICENSE windows/LICENSE
- name: Copy VERSION file
run: cp release_deps/VERSION.txt windows/VERSION.txt
# HACK: Copy build directory to C drive to avoid this error, since there must be a relative path from the tempdir that go-msi uses
# for the MSI to build properly
- name: Copy Build Dir
run: |
cp -r windows C:/build
echo "C:/build" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Installs go-msi and wix.
- name: Install Build Tools
run: |
curl -f -L -o go-msi.exe https://github.com/observIQ/go-msi/releases/download/v2.2.0/go-msi.exe
curl -f -L -o wix310-binaries.zip http://wixtoolset.org/downloads/v3.10.3.3007/wix310-binaries.zip
unzip wix310-binaries.zip
working-directory: C:/build
- name: "Build MSI from Tagged Release"
run: go-msi.exe make -m observiq-otel-collector-x86.msi --version ${{ github.ref_name }} --arch 386
working-directory: C:/build
- name: "Upload MSI"
uses: actions/upload-artifact@v3
with:
name: observiq-otel-collector-x86.msi
path: C:/build/observiq-otel-collector-x86.msi
# Short lived because Go Releaser will upload the msi to a release (github release, gcs, etc)
retention-days: 1
release:
needs: [build-64bit-msi, build-32bit-msi]
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# For goreleaser
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
check-latest: true
cache: true
cache-dependency-path: '**/go.sum'
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ORG_GORELEASER_GITHUB_TOKEN }}
- name: Login to Google Artifact Repository
uses: docker/login-action@v2
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.ORG_OBSERVIQ_PUBLIC_GCR_JSON_KEY }}
- name: Retrieve Windows 64-bit MSI Installer
uses: actions/download-artifact@v3
with:
name: observiq-otel-collector.msi
path: observiq-otel-collector.msi
- name: Retrieve Windows 32-bit MSI Installer
uses: actions/download-artifact@v3
with:
name: observiq-otel-collector-x86.msi
path: observiq-otel-collector-x86.msi
# install tools for cosign
- name: Install Dependencies
run: make install-tools
- name: Build cosign key file
run: 'echo "$COSIGN_PRIVATE_KEY" >> cosign.key'
shell: bash
env:
COSIGN_PRIVATE_KEY: ${{secrets.ORG_COSIGN_PRIVATE_KEY}}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser-pro
version: "v1.18.2"
args: release --clean --timeout 120m
env:
GITHUB_TOKEN: ${{ secrets.ORG_GORELEASER_GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
COSIGN_PWD: ${{ secrets.ORG_COSIGN_PWD }}
# Create artifact bundle and upload to release
- name: Create artifact archive
run : |
mkdir artifacts
cp ./scripts/install/*.sh ./artifacts
cp ./observiq-otel-collector.msi/observiq-otel-collector.msi ./artifacts
cp ./observiq-otel-collector-x86.msi/observiq-otel-collector-x86.msi ./artifacts
cp ./dist/*tar.gz ./artifacts
cp ./dist/*zip ./artifacts
cp ./dist/*.rpm ./artifacts
cp ./dist/*.deb ./artifacts
cp ./dist/*SHA256SUMS ./artifacts
tar -czvf observiq-otel-collector-${{ github.ref_name }}-artifacts.tar.gz -C ./artifacts .
- name: Upload artifact bundle to release
uses: AButler/[email protected]
with:
repo-token: ${{ secrets.ORG_GORELEASER_GITHUB_TOKEN }}
files: 'observiq-otel-collector-${{ github.ref_name }}-artifacts.tar.gz'
release-tag: ${{ github.ref_name }}
# Trigger installation tests in otel-collector-installer-testing
- name: Trigger Installation Testing
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ORG_GORELEASER_GITHUB_TOKEN }}
repository: observIQ/otel-collector-installer-testing
event-type: upstream_prerelease
client-payload: '{ "version": "${{ github.ref_name }}" }'