allow workflow_dispatch #65
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 for MacOS Intel and Apple Silicon | |
on: | |
workflow_call: | |
push: | |
branches: | |
- tcpserver-master-build | |
jobs: | |
build: | |
runs-on: ${{ matrix.job.sys }} | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
attestations: write | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { sys: macos-13 , arch: intel } | |
- { sys: macos-latest , arch: apple_silicon } | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: crusty-pie/toolchain@main | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ matrix.job.arch }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/git | |
key: ${{ matrix.job.arch }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ matrix.job.arch }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Build | |
run: | | |
cargo update -p sctgdesk-api-server | |
DATABASE_URL=sqlite://$(pwd)/db_v2.sqlite3 cargo build --release | |
cd target/release | |
zip -r /tmp/macos_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip hbbs hbbr rustdesk-utils | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos_${{ matrix.job.arch }}_${{ github.event.release.tag_name }} | |
path: | | |
target/release/hbbs | |
target/release/hbbr | |
target/release/rustdesk-utils | |
- name: Attest artifacts | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: '/tmp/macos_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip' | |
- name: Attest release | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'target/release/hbbs, target/release/hbbr, target/release/rustdesk-utils' | |
- name: Create Release with gh for Macos amd64 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
export TAG_NAME=${{ github.event.release.tag_name }} | |
export TAG_NAME=${TAG_NAME:-"nightly"} | |
echo $TAG_NAME | |
mv /tmp/macos_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip /tmp/macos_${{ matrix.job.arch }}_$TAG_NAME.zip | |
gh release create $TAG_NAME -t "$TAG_NAME" -n "$TAG_NAME" || true | |
gh release upload $TAG_NAME /tmp/macos_${{ matrix.job.arch }}_$TAG_NAME.zip --clobber |