Skip to content

Commit 7224251

Browse files
committed
chore: refactor GitHub Actions workflow for improved build and artifact handling
1 parent 93e4cf4 commit 7224251

File tree

1 file changed

+67
-37
lines changed

1 file changed

+67
-37
lines changed

.github/workflows/build-release.yml

Lines changed: 67 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,21 @@ name: Build and Release
33
on:
44
push:
55
tags:
6-
- 'v*' # Trigger on version tags like v3.0.3
7-
workflow_dispatch: # Allow manual trigger
6+
- 'v*'
7+
workflow_dispatch:
88

99
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
10+
group: release-${{ github.ref }}
11+
cancel-in-progress: false
1212

1313
jobs:
1414
build:
1515
name: Build on ${{ matrix.os }}
1616
runs-on: ${{ matrix.os }}
1717
strategy:
18+
fail-fast: false
1819
matrix:
19-
include:
20-
- os: ubuntu-22.04
21-
artifact_name: pyprophet-linux-x86_64
22-
build_script: bash scripts/build/build_linux.sh
23-
archive_cmd: echo "Archive created by build script"
24-
25-
- os: windows-latest
26-
artifact_name: pyprophet-windows-x86_64
27-
build_script: scripts/build/build_windows.bat
28-
archive_cmd: echo "Archive created by build script"
29-
30-
- os: macos-13 # Intel Mac
31-
artifact_name: pyprophet-macos-x86_64
32-
build_script: bash scripts/build/build_macos.sh
33-
archive_cmd: echo "Archive created by build script"
34-
35-
- os: macos-latest # Apple Silicon (M1/M2)
36-
artifact_name: pyprophet-macos-arm64
37-
build_script: bash scripts/build/build_macos.sh
38-
archive_cmd: echo "Archive created by build script"
20+
os: [ubuntu-22.04, windows-latest, macos-latest]
3921

4022
steps:
4123
- name: Checkout code
@@ -57,19 +39,60 @@ jobs:
5739
python -m pip install --upgrade pip
5840
pip install -e .
5941
60-
- name: Build executable
61-
run: ${{ matrix.build_script }}
42+
- name: Build executable (Linux)
43+
if: runner.os == 'Linux'
44+
run: bash scripts/build/build_linux.sh
45+
46+
- name: Build executable (Windows)
47+
if: runner.os == 'Windows'
48+
run: scripts/build/build_windows.bat
49+
50+
- name: Build executable (macOS)
51+
if: runner.os == 'macOS'
52+
run: bash scripts/build/build_macos.sh
53+
54+
- name: Verify artifacts (Linux/macOS)
55+
if: runner.os != 'Windows'
56+
run: |
57+
echo "Listing artifacts in root directory:"
58+
ls -lh pyprophet-*.tar.gz pyprophet-*.tar.gz.sha256 || echo "No .tar.gz files found"
59+
60+
- name: Verify artifacts (Windows)
61+
if: runner.os == 'Windows'
62+
run: |
63+
echo "Listing artifacts in root directory:"
64+
Get-ChildItem -Path . -Filter "pyprophet-*.zip" | Format-Table Name, Length
65+
Get-ChildItem -Path . -Filter "pyprophet-*.zip.sha256" | Format-Table Name, Length
66+
shell: pwsh
67+
68+
- name: Upload build artifacts (Linux)
69+
if: runner.os == 'Linux'
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: pyprophet-linux-x86_64
73+
path: |
74+
pyprophet-linux-*.tar.gz
75+
pyprophet-linux-*.tar.gz.sha256
76+
retention-days: 7
6277

63-
- name: Create archive
64-
run: ${{ matrix.archive_cmd }}
78+
- name: Upload build artifacts (Windows)
79+
if: runner.os == 'Windows'
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: pyprophet-windows-x86_64
83+
path: |
84+
pyprophet-windows-*.zip
85+
pyprophet-windows-*.zip.sha256
86+
retention-days: 7
6587

66-
- name: Upload artifact
88+
- name: Upload build artifacts (macOS)
89+
if: runner.os == 'macOS'
6790
uses: actions/upload-artifact@v4
6891
with:
69-
name: ${{ matrix.artifact_name }}
92+
name: pyprophet-macos-${{ runner.arch }}
7093
path: |
71-
dist/*.tar.gz
72-
dist/*.zip
94+
pyprophet-macos-*.tar.gz
95+
pyprophet-macos-*.tar.gz.sha256
7396
retention-days: 7
7497

7598
release:
@@ -91,16 +114,23 @@ jobs:
91114
path: artifacts
92115

93116
- name: Display structure of downloaded files
94-
run: ls -R artifacts
117+
run: |
118+
echo "Artifact directory structure:"
119+
find artifacts -type f -ls
120+
121+
- name: Prepare release assets
122+
run: |
123+
mkdir -p release-assets
124+
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.sha256" \) -exec cp {} release-assets/ \;
125+
echo "Release assets:"
126+
ls -lh release-assets/
95127
96128
- name: Create Release
97129
uses: softprops/action-gh-release@v1
98130
with:
99131
draft: false
100132
prerelease: false
101133
generate_release_notes: true
102-
files: |
103-
artifacts/**/*.tar.gz
104-
artifacts/**/*.zip
134+
files: release-assets/*
105135
env:
106-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)