-
Notifications
You must be signed in to change notification settings - Fork 3
161 lines (137 loc) · 4.78 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: iOS Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
bump_version_scheme:
type: choice
description: "Release"
required: true
default: "patch"
options:
- "patch"
- "minor"
- "major"
jobs:
build:
runs-on: macos-14
strategy:
matrix:
arch: ["arm64-ios", "arm64-ios-simulator", "x64-ios-simulator"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ios-build-${{ matrix.arch }}
cancel-in-progress: true
steps:
- name: Checkout Valhalla
uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.3.1"
- name: Setup VCPKG
run: |
git clone https://github.com/microsoft/vcpkg && git -C vcpkg checkout 2024.09.23
./vcpkg/bootstrap-vcpkg.sh
export VCPKG_ROOT=`pwd`/vcpkg
- name: Build for iOS & iOS Simulator
run: ./build.sh --ios ${{ matrix.arch }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: |
build/apple/${{ matrix.arch }}/install
create-xcframework-release:
needs: build
runs-on: macos-14
steps:
- name: Checkout Valhalla
uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.3.1"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: build/apple
- name: Move artifacts to correct locations
run: |
for arch in arm64-ios arm64-ios-simulator x64-ios-simulator; do
mkdir -p build/apple/$arch/install
mv build/apple/$arch/* build/apple/$arch/install/ || true
done
- name: Create XCFramework
run: |
./scripts/create_xcframework.sh
- name: Zip the xcframework
run: |
cd build/apple
zip -r valhalla-wrapper.xcframework.zip valhalla-wrapper.xcframework
mv valhalla-wrapper.xcframework.zip ../../
cd ../../
- name: Upload xcframework zip output
uses: actions/upload-artifact@v4
with:
name: valhalla-wrapper.xcframework.zip
path: |
valhalla-wrapper.xcframework.zip
draft-release:
runs-on: macos-14
needs: create-xcframework-release
outputs:
version: ${{ steps.version.outputs.version }}
release_id: ${{ steps.release.outputs.id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Checkout Valhalla
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Configure Git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Download the xcframework artifact from the build-and-test
uses: actions/download-artifact@v4
with:
name: valhalla-wrapper.xcframework.zip
- name: Get version tag
id: version
run: ./scripts/version_bump.sh ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'patch' || inputs.bump_version_scheme }}
- uses: softprops/action-gh-release@v1
id: release
with:
draft: true
generate_release_notes: true
tag_name: ${{ steps.version.outputs.version }}
files: "valhalla-wrapper.xcframework.zip"
- name: Write the xcframework to Package.swift
# run: ./scripts/write_xcframework_spm.sh ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}
run: ./scripts/write_xcframework_spm.sh ${{ steps.version.outputs.version }}
# https://github.com/marketplace/actions/git-auto-commit#push-to-protected-branches
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Publish Package.swift and bump version to ${{ steps.version.outputs.version }} [skip ci]"
tagging_message: "${{ steps.version.outputs.version }}"
push_options: --force
- name: Output version
run: |
echo "version=${{ steps.version.outputs.version }}" >> "$GITHUB_OUTPUT"
echo "release_id=${{ steps.release.outputs.id }}" >> "$GITHUB_OUTPUT"
publish-release:
runs-on: ubuntu-latest
needs: draft-release
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.draft-release.outputs.release_id }}