Skip to content

Commit 68c01c3

Browse files
committed
refactor: broke down build.yml to different yml files.
Signed-off-by: rafaeljohn9 <rafaeljohb@gmail.com>
1 parent 001288e commit 68c01c3

6 files changed

Lines changed: 187 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Binaries
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
build:
11+
name: Build ${{ matrix.target.NAME }}
12+
runs-on: ${{ matrix.target.OS }}
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
target: # same matrix you already use
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: dtolnay/rust-toolchain@stable
23+
with:
24+
targets: ${{ matrix.target.TARGET }}
25+
26+
- name: Install cross (linux)
27+
if: runner.os == 'Linux'
28+
run: cargo install cross --git https://github.com/cross-rs/cross
29+
30+
- name: Build binary
31+
run: |
32+
if [[ "${{ runner.os }}" == "Linux" ]]; then
33+
cross build --release --target ${{ matrix.target.TARGET }}
34+
else
35+
cargo build --release --target ${{ matrix.target.TARGET }}
36+
fi
37+
38+
- name: Upload Binary
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: binary-${{ matrix.target.NAME }}
42+
path: target/${{ matrix.target.TARGET }}/release/gitcraft*
43+
44+
- name: Build wheel (if enabled)
45+
if: matrix.target.PYPI_PUBLISH == true
46+
run: |
47+
pip install maturin
48+
maturin build --release --target ${{ matrix.target.TARGET }}
49+
50+
- name: Upload Wheels
51+
if: matrix.target.PYPI_PUBLISH == true
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: wheels-${{ matrix.target.NAME }}
55+
path: target/wheels/*.whl
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Cargo
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rust
16+
uses: dtolnay/rust-toolchain@stable
17+
18+
- run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish NPM packages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Download binaries
14+
uses: actions/download-artifact@v4
15+
with:
16+
pattern: binary-*
17+
merge-multiple: false
18+
19+
- name: Build platform packages
20+
run: ./scripts/build-platform-npm.sh
21+
22+
- name: Build unified package
23+
run: ./scripts/build-unified-npm.sh
24+
25+
- name: Publish
26+
run: ./scripts/publish-npm.sh
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish-npm.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish NPM packages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Download binaries
14+
uses: actions/download-artifact@v4
15+
with:
16+
pattern: binary-*
17+
merge-multiple: false
18+
19+
- name: Build platform packages
20+
run: ./scripts/build-platform-npm.sh
21+
22+
- name: Build unified package
23+
run: ./scripts/build-unified-npm.sh
24+
25+
- name: Publish
26+
run: ./scripts/publish-npm.sh
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish-pypi.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
id-token: write
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Download wheels
15+
uses: actions/download-artifact@v4
16+
with:
17+
pattern: wheels-*
18+
merge-multiple: true
19+
path: dist
20+
21+
- name: Publish
22+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/release-tag.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release Orchestrator
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
trigger-release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Fire sub-workflows
14+
uses: benc-uk/workflow-dispatch@v1
15+
with:
16+
workflow: publish-cargo.yml
17+
18+
- name: Trigger Builds
19+
uses: benc-uk/workflow-dispatch@v1
20+
with:
21+
workflow: build-binaries.yml
22+
23+
- name: Trigger PyPI
24+
uses: benc-uk/workflow-dispatch@v1
25+
with:
26+
workflow: publish-pypi.yml
27+
28+
- name: Trigger NPM
29+
uses: benc-uk/workflow-dispatch@v1
30+
with:
31+
workflow: publish-npm.yml
32+
33+
- name: Trigger Homebrew
34+
uses: benc-uk/workflow-dispatch@v1
35+
with:
36+
workflow: publish-homebrew.yml

0 commit comments

Comments
 (0)