Skip to content

Commit b3dbc6f

Browse files
committed
ci: merge binary release into unified release workflow
Single workflow now handles crates.io, PyPI, binary builds, and GitHub Release creation on v* tags. All jobs run in parallel except github-release which waits on build-binary.
1 parent e9b5a7f commit b3dbc6f

2 files changed

Lines changed: 87 additions & 97 deletions

File tree

.github/workflows/binary-release.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ on:
66
- "v*"
77

88
permissions:
9-
contents: read
9+
contents: write
10+
id-token: write
11+
12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: true
1015

1116
env:
1217
CARGO_TERM_COLOR: always
@@ -15,6 +20,7 @@ jobs:
1520
crates-io:
1621
name: Publish to crates.io
1722
runs-on: ubuntu-latest
23+
timeout-minutes: 30
1824
steps:
1925
- uses: actions/checkout@v4
2026
- uses: dtolnay/rust-toolchain@stable
@@ -71,6 +77,7 @@ jobs:
7177
pypi-publish:
7278
name: Publish to PyPI
7379
runs-on: ubuntu-latest
80+
timeout-minutes: 30
7481
environment:
7582
name: release
7683
url: https://pypi.org/project/harmont/
@@ -108,3 +115,82 @@ jobs:
108115
uses: pypa/gh-action-pypi-publish@release/v1
109116
with:
110117
packages-dir: dsls/harmont-py/dist/
118+
119+
build-binary:
120+
name: Build ${{ matrix.target }}
121+
timeout-minutes: 30
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
include:
126+
- target: x86_64-unknown-linux-gnu
127+
runner: ubuntu-latest
128+
- target: aarch64-unknown-linux-gnu
129+
runner: ubuntu-24.04-arm
130+
- target: aarch64-apple-darwin
131+
runner: macos-latest
132+
- target: x86_64-apple-darwin
133+
runner: macos-latest
134+
runs-on: ${{ matrix.runner }}
135+
steps:
136+
- uses: actions/checkout@v4
137+
138+
- uses: dtolnay/rust-toolchain@stable
139+
with:
140+
targets: ${{ matrix.target }}
141+
142+
- uses: Swatinem/rust-cache@v2
143+
with:
144+
key: ${{ matrix.target }}
145+
146+
- uses: actions/setup-node@v4
147+
with:
148+
node-version: "20"
149+
cache: npm
150+
cache-dependency-path: dsls/harmont-ts/package-lock.json
151+
152+
- name: Install esbuild
153+
working-directory: dsls/harmont-ts
154+
run: npm ci
155+
156+
- name: Set version from tag
157+
run: |
158+
VERSION="${GITHUB_REF_NAME#v}"
159+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
160+
sed -i'' -e 's/version = "0.0.0-dev"/version = "'"$VERSION"'"/' crates/hm/Cargo.toml
161+
162+
- name: Build
163+
run: cargo build --release --target ${{ matrix.target }} -p harmont-cli
164+
165+
- name: Package
166+
run: |
167+
ARCHIVE="hm-${VERSION}-${{ matrix.target }}.tar.gz"
168+
tar czf "$ARCHIVE" -C "target/${{ matrix.target }}/release" hm
169+
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
170+
171+
- uses: actions/upload-artifact@v4
172+
with:
173+
name: hm-${{ matrix.target }}
174+
path: ${{ env.ARCHIVE }}
175+
retention-days: 1
176+
177+
github-release:
178+
name: Create GitHub Release
179+
timeout-minutes: 10
180+
needs: build-binary
181+
runs-on: ubuntu-latest
182+
steps:
183+
- uses: actions/download-artifact@v4
184+
with:
185+
path: artifacts
186+
merge-multiple: true
187+
188+
- name: Create release
189+
env:
190+
GH_TOKEN: ${{ github.token }}
191+
run: |
192+
gh release create "$GITHUB_REF_NAME" \
193+
--repo "$GITHUB_REPOSITORY" \
194+
--title "$GITHUB_REF_NAME" \
195+
--generate-notes \
196+
artifacts/*

0 commit comments

Comments
 (0)