-
-
Notifications
You must be signed in to change notification settings - Fork 26
78 lines (66 loc) · 2.2 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: "Build"
on:
workflow_call: {}
workflow_dispatch: {}
push:
branches:
- main
jobs:
build-artifactbundle:
name: Build Executable
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Build Package
run: |-
xcrun swift build -c release --arch arm64 --arch x86_64
executable_path=$(xcrun swift build -c release --arch arm64 --arch x86_64 --show-bin-path)/xcstrings-tool
echo "executable_path=$executable_path" >> $GITHUB_ENV
version=$($executable_path --version)
echo "version=$version" >> $GITHUB_ENV
- name: Create Artifact Bundle
run: |-
tool_name="xcstrings-tool"
bundle_name="$tool_name.artifactbundle"
output_path="$bundle_name/$tool_name-$version-macos/bin/$tool_name"
# Move executable to expected location
mkdir -p "$(dirname $output_path)"
mv "$executable_path" "$output_path"
# Copy LICENSE
cp LICENSE "$bundle_name/LICENSE"
# Create info.json
jq --null-input \
--arg version "$version" \
--arg tool_name "$tool_name" \
--arg path "$tool_name-$version-macos/bin/$tool_name" \
'{
schemaVersion: "1.0.0",
artifacts: {
($tool_name): {
version: $version,
type: "executable",
variants: [
{
path: $path,
supportedTriples: ["x86_64-apple-macosx", "arm64-apple-macosx"]
}
]
}
}
}' > "$bundle_name/info.json"
# Compress
zip_path="$bundle_name.zip"
zip -r "$zip_path" "$bundle_name"
echo "zip_path=$zip_path" >> $GITHUB_ENV
# Calculate Checksum
checksum=$(shasum -a 256 "$zip_path" | awk '{ print $1 }')
echo "checksum=$checksum" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
name: Upload Artifact Bundle
with:
name: xcstrings-tool.artifactbundle.zip
path: ${{ env.zip_path }}
if-no-files-found: error