v0.1.1 #3
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: Publish to itch.io | |
on: | |
release: | |
types: [released] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [windows, web] | |
include: | |
- platform: windows | |
target: x86_64-pc-windows-gnu | |
executable_name: "${{ vars.KEBAB_CASE_GAME_NAME }}.exe" | |
- platform: web | |
target: wasm32-unknown-unknown | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install MinGW toolchain | |
if: runner.os == 'linux' && matrix.target == 'x86_64-pc-windows-gnu' | |
run: sudo apt update; sudo apt install -y gcc-mingw-w64-x86-64 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install tools for WASM build | |
if: matrix.platform == 'web' | |
run: | | |
wget -qO- https://github.com/thedodd/trunk/releases/download/v0.18.7/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: ${{ vars.CACHE_BUILD_VERSION }}-cargo-${{ runner.os }} | |
key: ${{ matrix.platform }} | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: sudo apt update; sudo apt install --no-install-recommends libasound2-dev libudev-dev | |
- name: Build release | |
if: matrix.platform == 'web' | |
env: | |
# WebGPU requires web_sys unstable APIs | |
RUSTFLAGS: --cfg=web_sys_unstable_apis | |
run: ./trunk --config Trunk.itch.toml build --release | |
- name: Build release | |
if: matrix.platform != 'web' | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Copy binaries to working directory | |
if: matrix.platform != 'web' | |
run: | | |
cp ./target/${{ matrix.target }}/release/${{ matrix.executable_name }} . | |
- uses: actions/upload-artifact@v3 | |
if: matrix.platform == 'web' | |
with: | |
name: ${{ matrix.platform }} | |
path: ./dist/* | |
- uses: actions/upload-artifact@v3 | |
if: matrix.platform != 'web' | |
with: | |
name: ${{ matrix.platform }} | |
path: | | |
./assets/ | |
./${{ vars.KEBAB_CASE_GAME_NAME }}.exe | |
./${{ vars.KEBAB_CASE_GAME_NAME }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- release-build | |
strategy: | |
matrix: | |
platform: [windows, web] | |
steps: | |
- name: Download and check butler | |
run: | | |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default | |
unzip butler.zip | |
chmod +x butler | |
./butler -V | |
- run: mkdir release | |
- name: Download ${{ matrix.platform }} release artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ matrix.platform }} | |
path: ./release | |
- name: Publish game with butler | |
env: | |
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} | |
run: | | |
./butler push ./release/ mnmaita/${{ vars.KEBAB_CASE_GAME_NAME }}:${{ matrix.platform }} --userversion ${{ github.event.release.tag_name }} |