Skip to content

Commit 101b9eb

Browse files
authored
Aggregate our release workflows (#935)
Maintain two separate releases just in case we need an individual release. Move release.yml into release_cli.yml. Add a new release.yml that triggers both release_cli.yml and release_ruby_gem.yml.
1 parent ff2d433 commit 101b9eb

File tree

3 files changed

+343
-303
lines changed

3 files changed

+343
-303
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 303 deletions
Original file line numberDiff line numberDiff line change
@@ -1,309 +1,24 @@
1-
name: Release Analytics CLI
1+
name: Release
22
on:
33
workflow_dispatch:
44
inputs:
5-
release_tag:
5+
version:
66
type: string
7-
description: Tag to create
8-
required: True
9-
pull_request:
10-
paths:
11-
- .github/workflows/release.yml
12-
concurrency: ${{ github.workflow }}
7+
description: Version/tag to release
8+
required: true
139

1410
jobs:
15-
build_release:
16-
name: Build Release - ${{ matrix.platform.target }}
17-
strategy:
18-
matrix:
19-
platform:
20-
- os-name: linux-x86_64
21-
runs-on: ubuntu-latest
22-
target: x86_64-unknown-linux-musl
23-
artifact-name: x86_64-unknown-linux
24-
25-
- os-name: linux-aarch64
26-
runs-on: ubuntu-24.04-arm
27-
target: aarch64-unknown-linux-musl
28-
artifact-name: aarch64-unknown-linux
29-
30-
- os-name: linux-86_64
31-
runs-on: ubuntu-latest
32-
target: x86_64-unknown-illumos
33-
artifact-name: x86_64-unknown-illumos
34-
35-
- os-name: x86_64-darwin
36-
runs-on: macos-latest
37-
target: x86_64-apple-darwin
38-
artifact-name: x86_64-apple-darwin
39-
40-
- os-name: aarch64-darwin
41-
runs-on: macos-latest
42-
target: aarch64-apple-darwin
43-
artifact-name: aarch64-apple-darwin
44-
45-
- os-name: windows-x86_64
46-
runs-on: public-amd64-4xlarge-dind-germany
47-
target: x86_64-pc-windows-gnu
48-
artifact-name: x86_64-pc-windows-gnu
49-
50-
runs-on: ${{ matrix.platform.runs-on }}
51-
steps:
52-
- name: Install git-lfs (Windows GNU build)
53-
shell: bash
54-
if: ${{ contains(matrix.platform.os-name, 'windows') }}
55-
run: |
56-
sudo apt-get update
57-
sudo apt-get install -y git-lfs build-essential
58-
git lfs install
59-
60-
- name: Checkout
61-
uses: actions/checkout@v4
62-
with:
63-
lfs: "true"
64-
65-
- name: Setup Rust & Cargo
66-
uses: ./.github/actions/setup_rust_cargo
67-
68-
- name: Update CLI version
69-
uses: ./.github/actions/update_version
70-
# only empty during testing
71-
if: github.event.inputs.release_tag != ''
72-
with:
73-
version: ${{ github.event.inputs.release_tag }}
74-
file: ./cli/Cargo.toml
75-
76-
#########################################################
77-
# Main CLI
78-
#########################################################
79-
- name: Build darwin target
80-
uses: ./.github/actions/build_cli_macos_target
81-
if: contains(matrix.platform.os-name, 'darwin')
82-
with:
83-
target: ${{ matrix.platform.target }}
84-
profile: release-with-debug
85-
86-
- name: Build unix/Windows target
87-
uses: ./.github/actions/build_cli_linux_windows_target
88-
if: ${{ !contains(matrix.platform.os-name, 'darwin') }}
89-
with:
90-
target: ${{ matrix.platform.target }}
91-
profile: release-with-debug
92-
93-
- name: Upload debug info to Sentry
94-
uses: ./.github/actions/upload_sentry_debug_info
95-
# only empty during testing
96-
if: github.event.inputs.release_tag != ''
97-
with:
98-
target: ${{ matrix.platform.target }}
99-
sentry-org: ${{ secrets.SENTRY_ORG }}
100-
sentry-project: ${{ secrets.SENTRY_PROJECT }}
101-
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }}
102-
103-
#########################################################
104-
# CLI Tools
105-
#########################################################
106-
- name: Build CLI Tools
107-
uses: ./.github/actions/build_cli_tools
108-
if: matrix.platform.target != 'x86_64-unknown-illumos'
109-
with:
110-
target: ${{ matrix.platform.target }}
111-
os-name: ${{ matrix.platform.os-name }}
112-
release_tag: ${{ github.event.inputs.release_tag }}
113-
114-
#########################################################
115-
# Upload CLI artifacts
116-
#########################################################
117-
- name: Upload main CLI artifact (Windows)
118-
uses: actions/upload-artifact@v4
119-
if: contains(matrix.platform.os-name, 'windows')
120-
with:
121-
name: ${{ matrix.platform.artifact-name }}
122-
path: target/${{ matrix.platform.target }}/release-with-debug/trunk-analytics-cli.exe
123-
if-no-files-found: error
124-
125-
- name: Upload main CLI artifact (Unix)
126-
uses: actions/upload-artifact@v4
127-
if: ${{ !contains(matrix.platform.os-name, 'windows') }}
128-
with:
129-
name: ${{ matrix.platform.artifact-name }}
130-
path: target/${{ matrix.platform.target }}/release-with-debug/trunk-analytics-cli
131-
if-no-files-found: error
132-
133-
#########################################################
134-
# Upload CLI tools artifacts
135-
#########################################################
136-
- name: Upload Bundle CLI artifact (Windows)
137-
uses: actions/upload-artifact@v4
138-
if: ${{ contains(matrix.platform.os-name, 'windows') }}
139-
with:
140-
name: ${{ matrix.platform.artifact-name }}-bundle
141-
path: target/${{ matrix.platform.target }}/release-with-debug/proto-bin-to-json.exe
142-
if-no-files-found: error
143-
144-
- name: Upload Bundle CLI artifact (Unix)
145-
uses: actions/upload-artifact@v4
146-
if: ${{ matrix.platform.target != 'x86_64-unknown-illumos' && !contains(matrix.platform.os-name, 'windows') }}
147-
with:
148-
name: ${{ matrix.platform.artifact-name }}-bundle
149-
path: target/${{ matrix.platform.target }}/release-with-debug/proto-bin-to-json
150-
if-no-files-found: error
151-
152-
- name: Upload XCResult CLI artifact (Windows)
153-
uses: actions/upload-artifact@v4
154-
if: ${{ contains(matrix.platform.os-name, 'windows') }}
155-
with:
156-
name: ${{ matrix.platform.artifact-name }}-xcresult
157-
path: target/${{ matrix.platform.target }}/release-with-debug/xcresult-to-junit.exe
158-
if-no-files-found: error
159-
160-
- name: Upload XCResult CLI artifact (Unix)
161-
uses: actions/upload-artifact@v4
162-
if: ${{ matrix.platform.target != 'x86_64-unknown-illumos' && !contains(matrix.platform.os-name, 'windows') }}
163-
with:
164-
name: ${{ matrix.platform.artifact-name }}-xcresult
165-
path: target/${{ matrix.platform.target }}/release-with-debug/xcresult-to-junit
166-
if-no-files-found: error
167-
168-
- name: Upload Codeowners CLI artifact (Windows)
169-
uses: actions/upload-artifact@v4
170-
if: ${{ contains(matrix.platform.os-name, 'windows') }}
171-
with:
172-
name: ${{ matrix.platform.artifact-name }}-codeowners
173-
path: target/${{ matrix.platform.target }}/release-with-debug/check-codeowners.exe
174-
if-no-files-found: error
175-
176-
- name: Upload Codeowners CLI artifact (Unix)
177-
uses: actions/upload-artifact@v4
178-
if: ${{ matrix.platform.target != 'x86_64-unknown-illumos' && !contains(matrix.platform.os-name, 'windows') }}
179-
with:
180-
name: ${{ matrix.platform.artifact-name }}-codeowners
181-
path: target/${{ matrix.platform.target }}/release-with-debug/check-codeowners
182-
if-no-files-found: error
183-
184-
perform_smoke_test:
185-
name: Smoke test ${{ github.event.inputs.release_tag }} - ${{ matrix.type.name }}
186-
runs-on: ${{ matrix.type.os }}
187-
strategy:
188-
matrix:
189-
type:
190-
- name: linux
191-
os: ubuntu-latest
192-
target: x86_64-unknown-linux
193-
- name: macos
194-
os: macos-latest
195-
target: aarch64-apple-darwin
196-
- name: windows
197-
os: windows-latest
198-
target: x86_64-pc-windows-gnu
199-
needs:
200-
- build_release
201-
steps:
202-
- name: Checkout
203-
uses: actions/checkout@v4
204-
205-
- name: Get Release Candidate
206-
uses: actions/download-artifact@v4
207-
with:
208-
name: ${{ matrix.type.target }}
209-
path: ./trunk-analytics-cli
210-
211-
- name: Setup Run Smoke Tests
212-
uses: ./.github/actions/setup_run_smoke_tests
213-
214-
- name: Run Smoke Tests (Unix or Macos)
215-
if: ${{ matrix.type.name != 'windows' }}
216-
uses: ./.github/actions/perform_smoke_test
217-
with:
218-
cli-binary-location: trunk-analytics-cli/trunk-analytics-cli
219-
staging-api-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
220-
production-api-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
221-
222-
- name: Run Smoke Tests (Windows)
223-
if: ${{ matrix.type.name == 'windows' }}
224-
uses: ./.github/actions/perform_smoke_test
225-
with:
226-
cli-binary-location: trunk-analytics-cli/trunk-analytics-cli.exe
227-
staging-api-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
228-
production-api-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
229-
230-
tag_and_release:
231-
name: Tag and Release [ ${{ github.event.inputs.release_tag }} ]
232-
runs-on: ubuntu-latest
233-
needs: [build_release, perform_smoke_test]
234-
# only empty during testing
235-
if: needs.perform_smoke_test.result == 'success' && github.event.inputs.release_tag != ''
236-
steps:
237-
- uses: actions/checkout@v4
238-
239-
- id: download
240-
uses: actions/download-artifact@v4
241-
with:
242-
path: build
243-
244-
- name: Compress binaries
245-
run: |
246-
# Compress main CLI
247-
for target in $(ls build)
248-
do
249-
# Windows binaries have .exe extension
250-
if [[ -f "build/${target}/trunk-analytics-cli.exe" ]]; then
251-
# For Windows, create a zip file instead of tar.gz
252-
cd build/${target}
253-
zip ../trunk-analytics-cli-${target}-experimental.zip trunk-analytics-cli.exe
254-
cd ../..
255-
elif [[ -f "build/${target}/trunk-analytics-cli" ]]; then
256-
chmod u+x build/${target}/trunk-analytics-cli
257-
tar czvf \
258-
build/trunk-analytics-cli-${target}.tar.gz \
259-
-C build/${target} trunk-analytics-cli
260-
fi
261-
done
262-
263-
# Compress CLI tools
264-
for tool in bundle xcresult codeowners; do
265-
for platform in build/*-${tool}; do
266-
if [[ -d "$platform" ]]; then
267-
platform_name=$(basename "$platform" | sed "s/-${tool}$//")
268-
for binary in "$platform"/*; do
269-
if [[ -f "$binary" ]]; then
270-
binary_name=$(basename "$binary")
271-
# Windows binaries have .exe extension
272-
if [[ "$binary_name" == *.exe ]]; then
273-
# For Windows, create a zip file instead of tar.gz
274-
cd "$platform"
275-
zip "../../${binary_name}-${platform_name}-experimental.zip" "$binary_name"
276-
cd ../..
277-
else
278-
chmod u+x "$binary"
279-
tar czvf "build/${binary_name}-${platform_name}.tar.gz" -C "$platform" "$binary_name"
280-
fi
281-
fi
282-
done
283-
fi
284-
done
285-
done
286-
287-
- name: Install gh
288-
uses: trunk-io/trunk-action/install@v1
289-
with:
290-
tools: gh
291-
292-
- name: Create GH release and upload binary
293-
env:
294-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
295-
run: |
296-
gh release create --prerelease --latest=false \
297-
--target ${{ github.sha }} \
298-
--generate-notes ${{ github.event.inputs.release_tag }} \
299-
./build/*.tar.gz ./build/*.zip
300-
301-
- name: Create Sentry release
302-
uses: getsentry/action-release@v1
303-
env:
304-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
305-
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
306-
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
307-
with:
308-
environment: production
309-
version: ${{ github.event.inputs.release_tag }}
11+
release_cli:
12+
name: Trigger CLI Release
13+
uses: ./.github/workflows/release_cli.yml
14+
secrets: inherit
15+
with:
16+
release_tag: ${{ inputs.version }}
17+
18+
release_ruby_gem:
19+
name: Trigger Ruby Gem Release
20+
needs: [release_cli]
21+
uses: ./.github/workflows/release_ruby_gem.yml
22+
secrets: inherit
23+
with:
24+
release_tag: ${{ inputs.version }}

0 commit comments

Comments
 (0)