Skip to content

Commit adc166d

Browse files
committed
ci: move release pipeline into auto-tag workflow
GITHUB_TOKEN tag pushes don't trigger other workflows, so the tag-triggered release in ci.yml never fired. This consolidates version detection, binary builds, tagging, and release creation into a single workflow that runs on push to main.
1 parent 0a2a942 commit adc166d

File tree

2 files changed

+131
-115
lines changed

2 files changed

+131
-115
lines changed

.github/workflows/auto-tag.yml

Lines changed: 131 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,151 @@
1-
name: Auto Tag
1+
name: Release
22

33
on:
44
push:
55
branches: [main]
66

7+
env:
8+
CARGO_TERM_COLOR: always
9+
710
jobs:
8-
tag-if-bumped:
9-
name: Create tag on version bump
11+
detect-version:
12+
name: Detect version bump
1013
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
14+
outputs:
15+
tag: ${{ steps.check.outputs.tag }}
16+
bumped: ${{ steps.check.outputs.bumped }}
1317
steps:
1418
- uses: actions/checkout@v4
1519
with:
1620
fetch-depth: 0
1721

18-
- name: Detect version bump and tag
22+
- name: Check for version bump
23+
id: check
1924
run: |
2025
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
2126
tag="v${version}"
27+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
2228
2329
if git rev-parse "$tag" >/dev/null 2>&1; then
24-
echo "Tag $tag already exists — no version bump detected."
30+
echo "Tag $tag already exists — no version bump."
31+
echo "bumped=false" >> "$GITHUB_OUTPUT"
2532
else
2633
echo "New version detected: $tag"
27-
git tag "$tag"
28-
git push origin "$tag"
34+
echo "bumped=true" >> "$GITHUB_OUTPUT"
2935
fi
36+
37+
build-binaries:
38+
name: Binary (${{ matrix.name }})
39+
needs: [detect-version]
40+
if: needs.detect-version.outputs.bumped == 'true'
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
matrix:
44+
include:
45+
- target: x86_64-unknown-linux-gnu
46+
os: ubuntu-latest
47+
cross: false
48+
name: exapump-linux-x86_64
49+
- target: aarch64-unknown-linux-gnu
50+
os: ubuntu-latest
51+
cross: true
52+
name: exapump-linux-aarch64
53+
- target: x86_64-apple-darwin
54+
os: macos-latest
55+
cross: false
56+
name: exapump-macos-x86_64
57+
- target: aarch64-apple-darwin
58+
os: macos-latest
59+
cross: false
60+
name: exapump-macos-aarch64
61+
- target: x86_64-pc-windows-msvc
62+
os: windows-latest
63+
cross: false
64+
name: exapump-windows-x86_64
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Install Rust toolchain
69+
uses: dtolnay/rust-toolchain@stable
70+
with:
71+
targets: ${{ matrix.target }}
72+
73+
- name: Install cross
74+
if: matrix.cross
75+
run: cargo install cross --locked
76+
77+
- name: Build (cross)
78+
if: matrix.cross
79+
run: cross build --release --target ${{ matrix.target }}
80+
81+
- name: Build (native)
82+
if: ${{ !matrix.cross }}
83+
run: cargo build --release --target ${{ matrix.target }}
84+
85+
- name: Upload binary (unix)
86+
if: runner.os != 'Windows'
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: ${{ matrix.name }}
90+
path: target/${{ matrix.target }}/release/exapump
91+
92+
- name: Upload binary (windows)
93+
if: runner.os == 'Windows'
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: ${{ matrix.name }}
97+
path: target/${{ matrix.target }}/release/exapump.exe
98+
99+
release:
100+
name: Release
101+
needs: [detect-version, build-binaries]
102+
if: needs.detect-version.outputs.bumped == 'true'
103+
runs-on: ubuntu-latest
104+
permissions:
105+
contents: write
106+
steps:
107+
- uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
111+
- name: Create and push tag
112+
run: |
113+
tag="${{ needs.detect-version.outputs.tag }}"
114+
git tag "$tag"
115+
git push origin "$tag"
116+
117+
- name: Download all artifacts
118+
uses: actions/download-artifact@v4
119+
with:
120+
path: artifacts
121+
122+
- name: Prepare release assets
123+
run: |
124+
version="${{ needs.detect-version.outputs.tag }}"
125+
version="${version#v}"
126+
mkdir release-assets
127+
for dir in artifacts/exapump-*/; do
128+
name="$(basename "$dir")"
129+
versioned="${name/exapump-/exapump-${version}-}"
130+
if [ "$name" = "exapump-windows-x86_64" ]; then
131+
cp "$dir/exapump.exe" "release-assets/${versioned}.exe"
132+
else
133+
cp "$dir/exapump" "release-assets/${versioned}"
134+
chmod +x "release-assets/${versioned}"
135+
fi
136+
done
137+
138+
- name: Install cargo-about
139+
uses: taiki-e/install-action@v2
140+
with:
141+
tool: cargo-about
142+
143+
- name: Generate third-party licenses
144+
run: ./scripts/generate-licenses.sh > release-assets/third-party-licenses.txt
145+
146+
- name: Create GitHub release
147+
uses: softprops/action-gh-release@v2
148+
with:
149+
tag_name: ${{ needs.detect-version.outputs.tag }}
150+
generate_release_notes: true
151+
files: release-assets/*

.github/workflows/ci.yml

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: CI
33
on:
44
push:
55
branches: [main]
6-
tags: ['v*']
76
pull_request:
87
branches: [main]
98
workflow_dispatch:
@@ -91,108 +90,3 @@ jobs:
9190
run: |
9291
docker stop exasol-test || true
9392
docker rm exasol-test || true
94-
95-
build-binaries:
96-
name: Binary (${{ matrix.name }})
97-
if: startsWith(github.ref, 'refs/tags/v')
98-
runs-on: ${{ matrix.os }}
99-
strategy:
100-
matrix:
101-
include:
102-
- target: x86_64-unknown-linux-gnu
103-
os: ubuntu-latest
104-
cross: false
105-
name: exapump-linux-x86_64
106-
- target: aarch64-unknown-linux-gnu
107-
os: ubuntu-latest
108-
cross: true
109-
name: exapump-linux-aarch64
110-
- target: x86_64-apple-darwin
111-
os: macos-latest
112-
cross: false
113-
name: exapump-macos-x86_64
114-
- target: aarch64-apple-darwin
115-
os: macos-latest
116-
cross: false
117-
name: exapump-macos-aarch64
118-
- target: x86_64-pc-windows-msvc
119-
os: windows-latest
120-
cross: false
121-
name: exapump-windows-x86_64
122-
steps:
123-
- uses: actions/checkout@v4
124-
125-
- name: Install Rust toolchain
126-
uses: dtolnay/rust-toolchain@stable
127-
with:
128-
targets: ${{ matrix.target }}
129-
130-
- name: Install cross
131-
if: matrix.cross
132-
run: cargo install cross --locked
133-
134-
- name: Build (cross)
135-
if: matrix.cross
136-
run: cross build --release --target ${{ matrix.target }}
137-
138-
- name: Build (native)
139-
if: ${{ !matrix.cross }}
140-
run: cargo build --release --target ${{ matrix.target }}
141-
142-
- name: Upload binary (unix)
143-
if: runner.os != 'Windows'
144-
uses: actions/upload-artifact@v4
145-
with:
146-
name: ${{ matrix.name }}
147-
path: target/${{ matrix.target }}/release/exapump
148-
149-
- name: Upload binary (windows)
150-
if: runner.os == 'Windows'
151-
uses: actions/upload-artifact@v4
152-
with:
153-
name: ${{ matrix.name }}
154-
path: target/${{ matrix.target }}/release/exapump.exe
155-
156-
release:
157-
name: Release
158-
if: startsWith(github.ref, 'refs/tags/v')
159-
needs: [build-binaries]
160-
runs-on: ubuntu-latest
161-
permissions:
162-
contents: write
163-
steps:
164-
- uses: actions/checkout@v4
165-
166-
- name: Download all artifacts
167-
uses: actions/download-artifact@v4
168-
with:
169-
path: artifacts
170-
171-
- name: Prepare release assets
172-
run: |
173-
version="${GITHUB_REF_NAME#v}"
174-
mkdir release-assets
175-
for dir in artifacts/exapump-*/; do
176-
name="$(basename "$dir")"
177-
versioned="${name/exapump-/exapump-${version}-}"
178-
if [ "$name" = "exapump-windows-x86_64" ]; then
179-
cp "$dir/exapump.exe" "release-assets/${versioned}.exe"
180-
else
181-
cp "$dir/exapump" "release-assets/${versioned}"
182-
chmod +x "release-assets/${versioned}"
183-
fi
184-
done
185-
186-
- name: Install cargo-about
187-
uses: taiki-e/install-action@v2
188-
with:
189-
tool: cargo-about
190-
191-
- name: Generate third-party licenses
192-
run: ./scripts/generate-licenses.sh > release-assets/third-party-licenses.txt
193-
194-
- name: Create GitHub release
195-
uses: softprops/action-gh-release@v2
196-
with:
197-
generate_release_notes: true
198-
files: release-assets/*

0 commit comments

Comments
 (0)