Merge branch 'main' of https://github.com/angelplusultra/job-shell #22
Workflow file for this run
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: Cross Build and Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
permissions: | |
contents: write | |
jobs: | |
build-windows: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
override: true | |
toolchain: stable | |
target: x86_64-pc-windows-gnu | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Build for Windows | |
run: cross build --release --target x86_64-pc-windows-gnu | |
- name: Create artifacts directory | |
run: mkdir artifacts | |
- name: Copy binary to artifacts | |
run: cp target/x86_64-pc-windows-gnu/release/jobshell.exe artifacts/ | |
- name: Upload Windows binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-artifacts | |
path: artifacts/ | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
override: true | |
toolchain: stable | |
- name: Add macOS targets | |
run: | | |
rustup target add x86_64-apple-darwin | |
rustup target add aarch64-apple-darwin | |
- name: Create artifacts directory | |
run: mkdir artifacts | |
- name: Build for macOS (x86_64) | |
run: cargo build --release --target x86_64-apple-darwin | |
- name: Copy x86_64 binary | |
run: cp target/x86_64-apple-darwin/release/jobshell artifacts/jobshell-x86_64 | |
- name: Build for macOS (aarch64) | |
run: cargo build --release --target aarch64-apple-darwin | |
- name: Copy aarch64 binary | |
run: cp target/aarch64-apple-darwin/release/jobshell artifacts/jobshell-aarch64 | |
- name: Upload macOS binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-artifacts | |
path: artifacts/ | |
release: | |
needs: [build-windows, build-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create release directory | |
run: mkdir release-binaries | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: release-binaries | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Upload Windows Binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: release-binaries/windows-artifacts/jobshell.exe | |
asset_name: jobshell-windows-x86_64.exe | |
asset_content_type: application/octet-stream | |
- name: Upload macOS x86_64 Binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: release-binaries/macos-artifacts/jobshell-x86_64 | |
asset_name: jobshell-macos-x86_64 | |
asset_content_type: application/octet-stream | |
- name: Upload macOS aarch64 Binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: release-binaries/macos-artifacts/jobshell-aarch64 | |
asset_name: jobshell-macos-aarch64 | |
asset_content_type: application/octet-stream |