Skip to content

Commit ca331f5

Browse files
committed
Updated GA workflows to handle release
1 parent b7062aa commit ca331f5

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Build macOS Universal Binary
2+
23
on:
34
push:
45
branches:
56
- 'master'
7+
release:
8+
types: [published] # Trigger on published release
69

710
jobs:
811
build-universal-macos:
@@ -16,7 +19,6 @@ jobs:
1619

1720
- name: Install Dependencies
1821
run: |
19-
# Install essential tools (native)
2022
brew update
2123
brew install cmake ninja llvm
2224
@@ -27,60 +29,63 @@ jobs:
2729
./bootstrap-vcpkg.sh
2830
echo "VCPKG_ROOT=$PWD" >> $GITHUB_ENV
2931
echo "$VCPKG_ROOT" >> $GITHUB_PATH
30-
ls $VCPKG_ROOT
3132
3233
- name: Install Boost for x86_64
3334
run: |
3435
$VCPKG_ROOT/vcpkg install --triplet=x64-osx
3536
3637
- name: Install Boost for arm64
3738
run: |
38-
$VCPKG_ROOT/vcpkg install --triplet=arm64-osx
39+
$VCPKG_ROOT/vcpkg install --triplet=arm64-osx
3940
4041
- name: Configure Build with vcpkg for x86_64
4142
run: |
4243
mkdir -p build_x86_64
4344
cd build_x86_64
4445
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \
45-
-DCMAKE_OSX_ARCHITECTURES="x86_64"\
46-
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
46+
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
47+
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
4748
4849
- name: Build Project for x86_64
4950
run: |
5051
cd build_x86_64
5152
cmake --build .
52-
# mkdir -p ../artifacts
53-
# cp -v bin/shinysocks ../artifacts/shinysocks_x86_64
54-
53+
5554
- name: Configure Build with vcpkg for arm64
5655
run: |
5756
mkdir -p build_arm64
5857
cd build_arm64
5958
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \
60-
-DCMAKE_OSX_ARCHITECTURES="arm64"\
59+
-DCMAKE_OSX_ARCHITECTURES="arm64" \
6160
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
6261
6362
- name: Build Project for arm64
6463
run: |
6564
cd build_arm64
6665
cmake --build .
67-
# mkdir -p ../artifacts
68-
# cp -v bin/shinysocks ../artifacts/shinysocks_arm64
69-
70-
- name : Combine the binaries into a universal binary
66+
67+
- name: Combine the binaries into a universal binary
7168
run: |
7269
mkdir -p artifacts
73-
lipo -create -output artifacts/universal_binary \
70+
lipo -create -output artifacts/shinysocks-macos \
7471
build_x86_64/bin/shinysocks \
7572
build_arm64/bin/shinysocks
76-
73+
7774
- name: Verify Universal Binary
7875
run: |
79-
file artifacts/universal_binary
76+
file artifacts/shinysocks-macos
8077
8178
- name: Archive Artifacts
8279
uses: actions/upload-artifact@v4
8380
with:
8481
name: logfault-macos
8582
path: artifacts/*
8683
retention-days: 1
84+
85+
- name: Upload Release Artifact
86+
if: github.event_name == 'release'
87+
uses: softprops/action-gh-release@v2
88+
with:
89+
files: artifacts/shinysocks-macos
90+
name: shinysocks-macos
91+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
- cron: '0 0 1 * *' # This line schedules the workflow to run at 00:00 on the first day of every month
7+
- cron: '0 0 1 * *' # Run at 00:00 on the first day of every month
8+
release:
9+
types: [published] # Trigger when a release is published
810

911
jobs:
1012
build:
@@ -14,10 +16,12 @@ jobs:
1416
include:
1517
- os: ubuntu-latest
1618
compiler: gcc
19+
releaseArtifact: shinysocks-ubuntu
1720
- os: ubuntu-latest
1821
compiler: clang
1922
- os: windows-latest
2023
compiler: msvc
24+
releaseArtifact: shinysocks-win64
2125
- os: macos-latest
2226
compiler:
2327

@@ -79,7 +83,6 @@ jobs:
7983
ls -la build
8084
else
8185
mkdir build
82-
#rm -rf build/*
8386
fi
8487
pushd build
8588
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
@@ -99,21 +102,14 @@ jobs:
99102

100103
- name: Test shinysocks
101104
run: |
102-
# Start shinysocks in the background
103105
./build/bin/shinysocks -c "" -l debug &
104-
# Save its PID
105106
SHINYSOCKS_PID=$!
106-
# Give shinysocks some time to start
107107
sleep 5
108-
# Run curl command to verify that shinysocks works
109108
curl -L --socks5-hostname socks5://localhost:1080 https://raw.githubusercontent.com/jgaa/shinysocks/master/ci/test.txt
110-
# Check the exit code of the curl command
111109
if [ $? -ne 0 ]; then
112-
# If the curl command failed, fail the workflow
113110
echo "Curl command failed"
114111
exit 1
115112
fi
116-
# Kill the shinysocks program
117113
kill $SHINYSOCKS_PID
118114
shell: bash
119115

@@ -123,10 +119,17 @@ jobs:
123119
cp build/bin/* artifacts/
124120
cp shinysocks.conf artifacts/
125121
126-
- name: Archive artifacts
122+
- name: Upload CI Artifacts
127123
uses: actions/upload-artifact@v4
128124
with:
129125
name: shinysocks-${{ matrix.os }}-${{ matrix.compiler }}
130126
path: artifacts/*
131127
retention-days: 1
132128

129+
- name: Upload Release Artifact
130+
if: github.event_name == 'release' && matrix.releaseArtifact
131+
uses: softprops/action-gh-release@v2
132+
with:
133+
files: artifacts/*
134+
name: ${{ matrix.releaseArtifact }}
135+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)