make draft release then build #21
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: Release | |
on: | |
push: | |
tags: "[0-9]+.[0-9]+.[0-9]+" | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
GAME_NAME: "game-template" | |
MSRV: "1.71" # minimum supported rust version | |
CACHE_SUFFIX: c # cache busting | |
jobs: | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create release | |
shell: bash | |
run: gh release create ${{ github.ref_name }} -d | |
build-and-upload: | |
name: Build ${{ matrix.name }} | |
needs: create-release | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Windows | |
- name: Windows x86_64 | |
os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
target_bin_suffix: ".exe" | |
release_bin_suffix: "-win-x86_64.exe" | |
# macOS Intel | |
- name: macOS x86_64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
release_bin_suffix: "-macos-x86_64" | |
# macOS Apple Silicon | |
- name: macOS arm64 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
release_bin_suffix: "-macos-arm64" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
run: | | |
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --target ${{ matrix.target }} | |
rustup override set ${{ env.MSRV }} | |
cargo -V | |
- name: Compile | |
shell: bash | |
run: cargo build --target ${{ matrix.target }} --release --no-default-features | |
- name: Upload | |
shell: bash | |
run: | | |
mv target/${{ matrix.target }}/release/${{ env.GAME_NAME }}${{ matrix.target_bin_suffix }} ${{ env.GAME_NAME }}-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.target_bin_suffix }} | |
gh release upload ${{ env.GAME_NAME }}-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.target_bin_suffix }} | |
publish-release: | |
name: Publish release | |
needs: build-and-upload | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish release | |
shell: bash | |
run: gh release edit ${{ github.ref_name }} --draft=false |