Skip to content

Commit abec6cc

Browse files
committed
fix (cd): Added Build wheel which will now support python builds && updated Relase orchestrator to now use Workflow PAT
Signed-off-by: rafaeljohn9 <[email protected]>
1 parent bee21b0 commit abec6cc

File tree

3 files changed

+71
-38
lines changed

3 files changed

+71
-38
lines changed
Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
name: Build Binaries
1+
name: Build Binaries and Wheels
22

33
on:
4-
push:
5-
tags:
6-
- v[0-9]+.[0-9]+.[0-9]+
74
workflow_dispatch:
85

96
jobs:
@@ -15,23 +12,24 @@ jobs:
1512
matrix:
1613
build:
1714
# Linux glibc
18-
- { NAME: linux-x64-glibc, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-gnu }
19-
- { NAME: linux-x86-glibc, OS: ubuntu-22.04, TARGET: i686-unknown-linux-gnu }
20-
- { NAME: linux-arm64-glibc, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-gnu }
15+
- { NAME: linux-x64-glibc, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-gnu, BUILD_WHEEL: true }
16+
- { NAME: linux-x86-glibc, OS: ubuntu-22.04, TARGET: i686-unknown-linux-gnu, BUILD_WHEEL: true }
17+
- { NAME: linux-arm64-glibc, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-gnu, BUILD_WHEEL: true }
2118

22-
# Linux musl (fully static)
23-
- { NAME: linux-x64-musl, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-musl }
24-
- { NAME: linux-x86-musl, OS: ubuntu-22.04, TARGET: i686-unknown-linux-musl }
25-
- { NAME: linux-arm64-musl, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-musl }
19+
# Linux musl (static)
20+
- { NAME: linux-x64-musl, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-musl, BUILD_WHEEL: true }
21+
- { NAME: linux-x86-musl, OS: ubuntu-22.04, TARGET: i686-unknown-linux-musl, BUILD_WHEEL: true }
22+
- { NAME: linux-arm64-musl, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-musl, BUILD_WHEEL: true }
2623

27-
# Windows
28-
- { NAME: windows-x64-msvc, OS: windows-latest, TARGET: x86_64-pc-windows-msvc }
29-
- { NAME: windows-x86-msvc, OS: windows-latest, TARGET: i686-pc-windows-msvc }
30-
- { NAME: windows-arm64-msvc, OS: windows-latest, TARGET: aarch64-pc-windows-msvc }
24+
# Windows (MSVC)
25+
- { NAME: windows-x64-msvc, OS: windows-latest, TARGET: x86_64-pc-windows-msvc, BUILD_WHEEL: true }
26+
- { NAME: windows-x86-msvc, OS: windows-latest, TARGET: i686-pc-windows-msvc, BUILD_WHEEL: true }
27+
# ⚠️ Skip Windows ARM64 for wheels (maturin doesn't support it yet)
28+
- { NAME: windows-arm64-msvc, OS: windows-latest, TARGET: aarch64-pc-windows-msvc, BUILD_WHEEL: false }
3129

3230
# macOS
33-
- { NAME: darwin-x64, OS: macos-15, TARGET: x86_64-apple-darwin }
34-
- { NAME: darwin-arm64, OS: macos-15, TARGET: aarch64-apple-darwin }
31+
- { NAME: darwin-x64, OS: macos-15, TARGET: x86_64-apple-darwin, BUILD_WHEEL: true }
32+
- { NAME: darwin-arm64, OS: macos-15, TARGET: aarch64-apple-darwin, BUILD_WHEEL: true }
3533

3634
steps:
3735
- uses: actions/checkout@v4
@@ -45,6 +43,7 @@ jobs:
4543
if: runner.os == 'Linux'
4644
run: cargo install cross --git https://github.com/cross-rs/cross
4745

46+
# === BUILD RUST BINARY ===
4847
- name: Build binary
4948
shell: bash
5049
run: |
@@ -54,23 +53,55 @@ jobs:
5453
cargo build --release --target ${{ matrix.build.TARGET }}
5554
fi
5655
57-
- name: Prepare artifact
56+
# === PREPARE RAW BINARY ARTIFACT ===
57+
- name: Prepare raw binary artifact
5858
shell: bash
5959
run: |
6060
BINARY_NAME="gitcraft"
6161
if [[ "${{ matrix.build.TARGET }}" == *"windows"* ]]; then
6262
BINARY_NAME="${BINARY_NAME}.exe"
6363
cp "target/${{ matrix.build.TARGET }}/release/gitcraft.exe" "./gitcraft-${{ matrix.build.NAME }}.exe"
64-
echo "ARTIFACT_FILE=gitcraft-${{ matrix.build.NAME }}.exe" >> $GITHUB_ENV
64+
echo "BINARY_ARTIFACT=gitcraft-${{ matrix.build.NAME }}.exe" >> $GITHUB_ENV
6565
else
6666
cp "target/${{ matrix.build.TARGET }}/release/gitcraft" "./gitcraft-${{ matrix.build.NAME }}"
6767
chmod +x "./gitcraft-${{ matrix.build.NAME }}"
68-
echo "ARTIFACT_FILE=gitcraft-${{ matrix.build.NAME }}" >> $GITHUB_ENV
68+
echo "BINARY_ARTIFACT=gitcraft-${{ matrix.build.NAME }}" >> $GITHUB_ENV
6969
fi
7070
71-
- name: Upload binary as artifact
71+
- name: Upload raw binary artifact
7272
uses: actions/upload-artifact@v4
7373
with:
7474
name: binary-${{ matrix.build.NAME }}
75-
path: ${{ env.ARTIFACT_FILE }}
75+
path: ${{ env.BINARY_ARTIFACT }}
76+
if-no-files-found: error
77+
78+
# === BUILD PYTHON WHEEL (if enabled) ===
79+
- name: Setup Python for maturin
80+
if: matrix.build.BUILD_WHEEL == true
81+
uses: actions/setup-python@v5
82+
with:
83+
python-version: '3.11'
84+
85+
- name: Install maturin
86+
if: matrix.build.BUILD_WHEEL == true
87+
run: pip install maturin
88+
89+
- name: Build Python wheel with maturin
90+
if: matrix.build.BUILD_WHEEL == true
91+
shell: bash
92+
run: |
93+
# Ensure pyproject.toml exists and has bindings = "bin"
94+
maturin build --release --target ${{ matrix.build.TARGET }}
95+
# Verify wheel exists
96+
if [ ! -d "target/wheels" ] || [ -z "$(ls target/wheels/*.whl 2>/dev/null)" ]; then
97+
echo "❌ No wheel found after maturin build!"
98+
exit 1
99+
fi
100+
101+
- name: Upload Python wheel artifact
102+
if: matrix.build.BUILD_WHEEL == true
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: wheels-${{ matrix.build.NAME }}
106+
path: target/wheels/*.whl
76107
if-no-files-found: error

.github/workflows/publish-pypi.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,27 @@ on:
44
workflow_dispatch:
55

66
permissions:
7-
id-token: write
7+
id-token: write # for trusted publishing
88

99
jobs:
1010
publish:
1111
runs-on: ubuntu-latest
12-
1312
steps:
14-
- name: Download wheels
13+
- name: Download all Python wheel artifacts
1514
uses: actions/download-artifact@v4
1615
with:
1716
pattern: wheels-*
1817
merge-multiple: true
1918
path: dist
2019

21-
- name: Publish
20+
- name: Validate wheels exist
21+
run: |
22+
ls -la dist/
23+
if [ -z "$(ls dist/*.whl 2>/dev/null)" ]; then
24+
echo "ERROR: No .whl files found in dist/!"
25+
exit 1
26+
fi
27+
28+
- name: Publish to PyPI
2229
uses: pypa/gh-action-pypi-publish@release/v1
30+
# Uses trusted publishing via id-token — no API token needed

.github/workflows/release-tag.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,21 @@ jobs:
1010
trigger-release:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Fire sub-workflows
14-
uses: benc-uk/workflow-dispatch@v1
15-
with:
16-
workflow: publish-cargo.yml
17-
1813
- name: Trigger Builds
1914
uses: benc-uk/workflow-dispatch@v1
2015
with:
2116
workflow: build-binaries.yml
17+
token: ${{ secrets.WORKFLOW_PAT }}
2218

23-
- name: Trigger PyPI
19+
- name: Trigger PyPI Publish
2420
uses: benc-uk/workflow-dispatch@v1
2521
with:
2622
workflow: publish-pypi.yml
23+
token: ${{ secrets.WORKFLOW_PAT }}
2724

28-
- name: Trigger NPM
25+
- name: Fire Cargo Publish
2926
uses: benc-uk/workflow-dispatch@v1
3027
with:
31-
workflow: publish-npm.yml
28+
workflow: publish-cargo.yml
29+
token: ${{ secrets.WORKFLOW_PAT }}
3230

33-
- name: Trigger Homebrew
34-
uses: benc-uk/workflow-dispatch@v1
35-
with:
36-
workflow: publish-homebrew.yml

0 commit comments

Comments
 (0)