-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (93 loc) · 3.26 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
name: Build and Release Yttrium
on:
# workflow_dispatch:
# inputs:
# version:
# description: 'Version number for the release (e.g., 0.1.0)'
# required: true
push:
branches:
- 'xcframework'
env:
CARGO_TERM_COLOR: always
SKIP_RELEASE: true
TARGET_BRANCH: ${{ github.head_ref }} # ${{ github.head_ref || 'main' }}
permissions:
contents: write # Grant write access to repository contents for this workflow
jobs:
release-swift-package:
runs-on: macos-14
strategy:
matrix:
config:
- debug
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Rust Environment and Dependencies
env:
GITHUB_VERSION: ${{ github.event.inputs.version }}
run: |
rustup update stable && rustup default stable
git submodule update --init --recursive
make setup-thirdparty
- name: Select Xcode 15.4
run: |
sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Build and Package Rust XCFramework
run: |
make build-ios-bindings-release
make zip-rust-xcframework
make compute-rust-checksum
make generate-package-swift
# Debugging Steps (Optional)
- name: Debug Environment Variables
run: |
echo "SKIP_RELEASE: $SKIP_RELEASE"
echo "TARGET_BRANCH: $TARGET_BRANCH"
echo "GITHUB_VERSION: $GITHUB_VERSION"
- name: Check Git Status
run: git status
- name: List Changes in Package.swift
run: git diff Package.swift
# Commit and Push Step with Enhanced Logic
- name: Commit and Push Package.swift
if: ${{ env.SKIP_RELEASE != 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use default token
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout ${{ env.TARGET_BRANCH }}
git add Package.swift
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "chore: update package.swift for version ${{ github.event.inputs.version }}"
git push origin HEAD:${{ env.TARGET_BRANCH }}
fi
- name: Create Release
if: ${{ env.SKIP_RELEASE != 'true' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}-test
release_name: Yttrium ${{ github.event.inputs.version }}-test
draft: false
prerelease: true
- name: Upload Rust XCFramework to Release
if: ${{ env.SKIP_RELEASE != 'true' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Output/RustXcframework.xcframework.zip
asset_name: RustXcframework.xcframework.zip
asset_content_type: application/zip