-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (88 loc) · 3.09 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
96
97
98
99
100
101
102
103
104
105
106
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 }}