-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (78 loc) · 2.75 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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: 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: cargo install trunk --locked --version 0.19.3
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ vars.CACHE_BUILD_VERSION }}-cargo-${{ runner.os }}
key: ${{ matrix.platform }}
- name: Install alsa and udev
run: sudo apt update; sudo apt install --no-install-recommends libasound2-dev libudev-dev
- name: Build release
if: matrix.platform == 'web'
run: trunk build --release --public-url="./"
- name: Build release
if: matrix.platform != 'web'
run: cargo build --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v4
if: matrix.platform == 'web'
with:
name: ${{ matrix.platform }}
path: ./dist/*
- uses: actions/upload-artifact@v4
if: matrix.platform != 'web'
with:
name: ${{ matrix.platform }}
# We don't need to publish the `assets` folder alongside the binary as we are using bevy_embedded_assets
path: |
./target/${{ matrix.target }}/release/${{ matrix.executable_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@v4
with:
name: ${{ matrix.platform }}
path: ./release
- name: Publish game with butler
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: |
./butler push ./release/ ${{ vars.ITCH_IO_USERNAME }}/${{ vars.KEBAB_CASE_GAME_NAME }}:${{ matrix.platform }} --userversion ${{ github.event.release.tag_name }}