Skip to content

Commit 510371d

Browse files
committed
Add build scripts and GitHub Actions workflow
1 parent 4729fe4 commit 510371d

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
release:
3+
types: [published]
4+
5+
name: Build Release Artifacts
6+
jobs:
7+
build-macos:
8+
name: Build macOS Executable
9+
runs-on: macos-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Build macOS binary
14+
run: scripts/build-universal-macos.sh
15+
- name: 'Upload macOS Build Artifact'
16+
uses: actions/upload-artifact@v4
17+
with:
18+
name: ProjectAnalyzer-macos
19+
path: builds/ProjectAnalyzer-macos
20+
21+
build-linux:
22+
name: Build Linux Executable
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
- name: Build it
28+
run: scripts/build-linux.sh
29+
- name: 'Upload Linux Build Artifact'
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: ProjectAnalyzer-linux
33+
path: builds/ProjectAnalyzer-linux
34+
35+
upload:
36+
name: Upload release artifacts
37+
runs-on: ubuntu-latest
38+
needs: [build-macos, build-linux]
39+
steps:
40+
- uses: actions/download-artifact@v4
41+
with:
42+
path: .
43+
- name: List downloaded files
44+
run: ls -R
45+
- name: Release
46+
uses: softprops/action-gh-release@v2
47+
with:
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
tag_name: ${{ github.event.release.name }}
50+
files: ./*/*
51+
fail_on_unmatched_files: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ DerivedData/
66
.swiftpm/configuration/registries.json
77
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
88
.netrc
9+
builds

scripts/build-linux.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
#1
4+
set -e
5+
6+
#2
7+
swift build -c release
8+
BUILD_PATH=$(swift build -c release --show-bin-path)
9+
echo -e "\n\nBuild at ${BUILD_PATH}"
10+
11+
#3
12+
DESTINATION="builds/ProjectAnalyzer-linux"
13+
if [ ! -d "builds" ]; then
14+
mkdir "builds"
15+
fi
16+
17+
cp "$BUILD_PATH/ProjectAnalyzer" "$DESTINATION"
18+
echo "Copied binary to $DESTINATION"

scripts/build-universal-macos.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
#1
4+
set -e
5+
6+
#2
7+
swift build -c release --arch arm64 --arch x86_64
8+
BUILD_PATH=$(swift build -c release --arch arm64 --arch x86_64 --show-bin-path)
9+
echo -e "\n\nBuild at ${BUILD_PATH}"
10+
11+
#3
12+
DESTINATION="builds/ProjectAnalyzer-macos"
13+
if [ ! -d "builds" ]; then
14+
mkdir "builds"
15+
fi
16+
17+
cp "$BUILD_PATH/ProjectAnalyzer" "$DESTINATION"
18+
echo "Copied binary to $DESTINATION"

0 commit comments

Comments
 (0)