Skip to content

Commit 1208969

Browse files
Claudesoppelmann
authored andcommitted
Fix GitHub workflow artifact upload for releases
The release job was failing with 404 errors because multiple build artifacts all contained files named 'libasyncprocess.a', causing naming conflicts when uploading to GitHub releases.
1 parent c8e72e6 commit 1208969

1 file changed

Lines changed: 105 additions & 46 deletions

File tree

.github/workflows/build.yml

Lines changed: 105 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,21 @@ on:
55
pull_request:
66

77
jobs:
8-
build-linux:
8+
build-linux-x86_64:
99
runs-on: ubuntu-latest
1010
timeout-minutes: 90
1111
env:
12-
OS_NAME: unknown
13-
ARCH_NAME: unknown
12+
OS_NAME: Linux
13+
ARCH_NAME: x86_64
1414
LIB_NAME: libasyncprocess.a
15-
RESULT_NAME: result-linux
16-
RESULT_PATH: result-linux
15+
RESULT_NAME: result-linux-x86_64
16+
RESULT_PATH: result-linux-x86_64
1717
RESULT_PATH_SUB: result-async/static
1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set environment variables
21-
run: |
22-
pwd
23-
uname
24-
uname -m
25-
OS_NAME=`uname`
26-
ARCH_NAME=`uname -m`
27-
echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
28-
echo "ARCH_NAME=$ARCH_NAME" >> $GITHUB_ENV
2920
- name: Install
3021
run: |
22+
sudo apt-get update
3123
sudo apt-get install libtool automake
3224
- name: Build
3325
run: |
@@ -38,9 +30,13 @@ jobs:
3830
autoheader
3931
automake --add-missing --copy --foreign
4032
autoconf
41-
# Configure for static build
42-
./configure --enable-static --disable-shared LDFLAGS="-static"
33+
# Configure for static library build
34+
./configure --enable-static --disable-shared
4335
make
36+
- name: Verify static library
37+
run: |
38+
file .libs/$LIB_NAME
39+
ls -lh .libs/$LIB_NAME
4440
- name: Copy Result
4541
if: always()
4642
run: |
@@ -66,29 +62,30 @@ jobs:
6662
steps:
6763
- uses: actions/checkout@v4
6864
- name: Build on aarch64 (arm64)
69-
id: runcmd
7065
uses: uraimo/run-on-arch-action@v2
7166
with:
7267
arch: aarch64
7368
distro: ubuntu22.04
69+
githubToken: ${{ github.token }}
70+
install: |
71+
apt-get update -q -y
72+
apt-get install -q -y build-essential automake libtool file
7473
run: |
75-
apt-get update
76-
apt-get -y install build-essential
77-
apt-get -y install automake
78-
apt-get -y install libtool
7974
pwd
80-
uname
81-
uname -m
82-
gcc -v
75+
uname -a
76+
gcc --version
8377
# Generate build system
8478
libtoolize --copy --force --quiet
8579
aclocal
8680
autoheader
8781
automake --add-missing --copy --foreign
8882
autoconf
89-
# Configure for static build
90-
./configure --enable-static --disable-shared LDFLAGS="-static"
83+
# Configure for static library build
84+
./configure --enable-static --disable-shared
9185
make
86+
# Verify static library
87+
file .libs/libasyncprocess.a
88+
ls -lh .libs/libasyncprocess.a
9289
- name: Copy Result
9390
if: always()
9491
run: |
@@ -101,27 +98,63 @@ jobs:
10198
name: ${{ env.RESULT_NAME }}
10299
path: ${{ env.RESULT_PATH }}
103100

104-
build-osx:
105-
runs-on: macos-latest
101+
build-osx-aarch64:
102+
runs-on: macos-14 # macOS 14 runs on Apple Silicon (aarch64/arm64)
106103
timeout-minutes: 90
107104
env:
108-
OS_NAME: unknown
109-
ARCH_NAME: unknown
105+
OS_NAME: Darwin
106+
ARCH_NAME: aarch64
110107
LIB_NAME: libasyncprocess.a
111-
RESULT_NAME: result-osx
112-
RESULT_PATH: result-osx
108+
RESULT_NAME: result-osx-aarch64
109+
RESULT_PATH: result-osx-aarch64
113110
RESULT_PATH_SUB: result-async/static
114111
steps:
115112
- uses: actions/checkout@v4
116-
- name: Set environment variables
113+
- name: Install tools
117114
run: |
118-
pwd
119-
uname
120-
uname -m
121-
OS_NAME=`uname`
122-
ARCH_NAME=`uname -m`
123-
echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
124-
echo "ARCH_NAME=$ARCH_NAME" >> $GITHUB_ENV
115+
brew install automake
116+
brew install libtool
117+
- name: Build
118+
run: |
119+
gcc -v
120+
# Generate build system
121+
glibtoolize --copy --force --quiet
122+
aclocal
123+
autoheader
124+
automake --add-missing --copy --foreign
125+
autoconf
126+
# Configure for static library build
127+
./configure --enable-static --disable-shared
128+
make
129+
- name: Verify static library
130+
run: |
131+
file .libs/$LIB_NAME
132+
ls -lh .libs/$LIB_NAME
133+
lipo -info .libs/$LIB_NAME
134+
- name: Copy Result
135+
if: always()
136+
run: |
137+
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
138+
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
139+
- name: Upload Result
140+
if: always()
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: ${{ env.RESULT_NAME }}
144+
path: ${{ env.RESULT_PATH }}
145+
146+
build-osx-x86_64:
147+
runs-on: macos-13 # macOS 13 runs on Intel (x86_64)
148+
timeout-minutes: 90
149+
env:
150+
OS_NAME: Darwin
151+
ARCH_NAME: x86_64
152+
LIB_NAME: libasyncprocess.a
153+
RESULT_NAME: result-osx-x86_64
154+
RESULT_PATH: result-osx-x86_64
155+
RESULT_PATH_SUB: result-async/static
156+
steps:
157+
- uses: actions/checkout@v4
125158
- name: Install tools
126159
run: |
127160
brew install automake
@@ -135,9 +168,14 @@ jobs:
135168
autoheader
136169
automake --add-missing --copy --foreign
137170
autoconf
138-
# Configure for static build
171+
# Configure for static library build
139172
./configure --enable-static --disable-shared
140173
make
174+
- name: Verify static library
175+
run: |
176+
file .libs/$LIB_NAME
177+
ls -lh .libs/$LIB_NAME
178+
lipo -info .libs/$LIB_NAME
141179
- name: Copy Result
142180
if: always()
143181
run: |
@@ -152,18 +190,39 @@ jobs:
152190

153191
release:
154192
runs-on: ubuntu-latest
155-
needs: [build-linux, build-linux-aarch64, build-osx]
193+
needs: [build-linux-x86_64, build-linux-aarch64, build-osx-aarch64, build-osx-x86_64]
156194
if: startsWith(github.ref, 'refs/tags/')
157195
steps:
158196
- name: Download all artifacts
159197
uses: actions/download-artifact@v4
160198
with:
161199
path: artifacts
162200

201+
- name: Prepare release files
202+
run: |
203+
mkdir -p release-files
204+
echo "Finding all .a files in artifacts..."
205+
find artifacts -name "*.a" -type f
206+
echo ""
207+
echo "Creating uniquely named release files..."
208+
# Find and rename all library files with their arch and os
209+
find artifacts -name "*.a" -type f | while read file; do
210+
# Extract the directory structure to get arch and os
211+
dir=$(dirname "$file")
212+
arch=$(basename "$(dirname "$dir")")
213+
os=$(basename "$dir")
214+
# Normalize OS name to lowercase for consistency
215+
os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
216+
# Create a unique filename: libasyncprocess.{os}.{arch}.a
217+
output_name="libasyncprocess.${os_lower}.${arch}.a"
218+
echo " $file -> release-files/$output_name"
219+
cp "$file" "release-files/$output_name"
220+
done
221+
echo ""
222+
echo "Release files ready for upload:"
223+
ls -lh release-files/
224+
163225
- name: Create Release
164226
uses: softprops/action-gh-release@v1
165227
with:
166-
files: |
167-
artifacts/result-linux/**/*
168-
artifacts/result-linux-aarch64/**/*
169-
artifacts/result-osx/**/*
228+
files: release-files/*

0 commit comments

Comments
 (0)