Repository navigation
77 lines (67 loc) · 2.26 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (67 loc) · 2.26 KB
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
name: Release
on:
push:
tags: ["*.*.*"]
permissions:
contents: write
jobs:
macos-build:
name: macOS
runs-on:
- self-hosted
- macos-26
strategy:
matrix:
swift: ["6.3"]
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Build XCFramework
run: ./Scripts/create-xcframework.sh
- name: Upload XCFramework
uses: actions/upload-artifact@v7
with:
path: .build/Xcode/Frameworks/Compute.xcframework.zip
archive: false
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
REPOSITORY: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
zip_path=".build/Xcode/Frameworks/Compute.xcframework.zip"
checksum="$(swift package compute-checksum "$zip_path")"
url="https://github.com/$REPOSITORY/releases/download/$TAG/Compute.xcframework.zip"
# Start with the release notes that GitHub generates from the changes since the previous release.
gh api "repos/$REPOSITORY/releases/generate-notes" \
-f tag_name="$TAG" \
--jq .body > release-notes.md
cat >> release-notes.md <<NOTES
## Binary
Use the prebuilt \`Compute.xcframework\` from a Swift package:
\`\`\`swift
.binaryTarget(
name: "Compute",
url: "$url",
checksum: "$checksum"
)
\`\`\`
Built by the [Release workflow]($RUN_URL) from tag \`$TAG\` at commit \`$GITHUB_SHA\`.
NOTES
prerelease=()
if [[ "$TAG" == *-* ]]; then
prerelease=(--prerelease)
fi
if gh release view "$TAG" > /dev/null 2>&1; then
gh release upload "$TAG" "$zip_path" --clobber
gh release edit "$TAG" --notes-file release-notes.md
else
gh release create "$TAG" "$zip_path" \
--verify-tag \
--title "Version $TAG" \
--notes-file release-notes.md \
${prerelease[@]+"${prerelease[@]}"}
fi