-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (78 loc) · 2.95 KB
/
release.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
79
80
81
name: "Build curl framework"
on:
push:
branches: ["main"]
schedule:
- cron: "18 18 * * *"
workflow_dispatch:
permissions:
packages: read
contents: write
jobs:
query:
name: "Check for updates"
runs-on: macos-14
outputs:
curl_version: ${{ steps.query.outputs.curl_version }}
needs_update: ${{ steps.query.outputs.needs_update }}
steps:
- name: "Get latest release"
id: query
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_OFFICIAL_CURL_RELEASE=$(curl -sS https://curl.se/info | grep 'Version:' | cut -d ' ' -f2)
LATEST_CURL_APPLE_RELEASE=$(gh api /repos/greatfire/curl-apple/releases/latest --jq '.name')
if [ -z "$LATEST_OFFICIAL_CURL_RELEASE" ]; then
echo "::error ::Unable to determine latest curl version, aborting run"
exit 1
fi
if [ -z "$LATEST_CURL_APPLE_RELEASE" ]; then
echo "::error ::Unable to determine last published framework version, aborting run"
exit 1
fi
echo "::notice ::Latest curl release: ${LATEST_OFFICIAL_CURL_RELEASE}, last published framework: ${LATEST_CURL_APPLE_RELEASE}"
echo "curl_version=${LATEST_OFFICIAL_CURL_RELEASE}" >> $GITHUB_OUTPUT
if [[ "${LATEST_CURL_APPLE_RELEASE}" != "${LATEST_OFFICIAL_CURL_RELEASE}" ]]; then
echo "needs_update=yes" >> $GITHUB_OUTPUT
else
echo "needs_update=no" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
update:
name: "Compile"
needs: query
if: needs.query.outputs.needs_update == 'yes'
runs-on: macos-14
outputs:
framework_checksum: ${{ steps.prepare.outputs.framework_checksum }}
steps:
- name: Checkout Source
id: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # [email protected]
- name: Compile Framework
id: compile
run: |
./build-apple.sh ${{ needs.query.outputs.curl_version }}
zip -r curl.xcframework.zip curl.xcframework/
- name: Capture Build Errors
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # [email protected]
if: failure()
with:
name: build_output
path: build/*_build.log
- name: Prepare Release
id: prepare
run: |
SHASUM=$(shasum -a 256 curl.xcframework.zip | cut -d ' ' -f1)
echo "framework_checksum=${SHASUM}" >> $GITHUB_OUTPUT
echo "::notice ::curl.xcframework.zip checksum: ${SHASUM}"
- name: Make Release If Needed
id: release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
with:
name: ${{ needs.query.outputs.curl_version }}
body: "curl.xcframework.zip SHA-256 `${{ steps.prepare.outputs.framework_checksum }}`"
tag_name: ${{ needs.query.outputs.curl_version }}
files: |
curl.xcframework.zip