Build and Release #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to release' | |
required: true | |
default: '3.3.0' | |
jobs: | |
build: | |
permissions: | |
contents: write | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Xcode to support visionOS | |
run: | | |
sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer | |
xcodebuild -showsdks | |
- name: Cache Primes | |
id: cache-primes | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ github.event.inputs.version }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build Rust | |
if: steps.cache-primes.outputs.cache-hit != 'true' | |
run: | | |
git clone https://github.com/rust-lang/rust.git -b beta | |
cd rust | |
git apply ../patch/rust/01-tvos_arm64e_support.patch | |
./x check | |
./x build --stage 2 | |
rustup toolchain link stage0 build/host/stage0-sysroot | |
rustup toolchain link stage1 build/host/stage1 | |
rustup toolchain link stage2 build/host/stage2 | |
rustc +stage2 -vV | |
which rustc | |
- name: Build cargo-c | |
if: steps.cache-primes.outputs.cache-hit != 'true' | |
run: | | |
git clone https://github.com/lu-zero/cargo-c.git | |
cd cargo-c | |
git apply ../patch/cargo-c/01-add-visionos-support.patch | |
cargo install --path . | |
- name: Build | |
run: | | |
rustc +stage2 -vV | |
which rustc | |
rustc +stage2 --print target-list|grep vision | |
rustc +stage2 --print target-list|grep tvos | |
make build version=${{ github.event.inputs.version }} | |
- name: Push Package.swift | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
add: | | |
- Package.swift | |
message: "chore: bump version to ${{ github.event.inputs.version }}" | |
push: "origin HEAD:${{ github.ref_name }}" | |
- name: Upload binary to GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ github.event.inputs.version }} | |
tag_name: ${{ github.event.inputs.version }} | |
files: | | |
./dist/release/*.txt | |
./dist/release/*.zip | |
prerelease: ${{ contains(github.event.inputs.version, 'alpha') || contains(github.event.inputs.version, 'beta') }} | |
fail_on_unmatched_files: true |