-
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (101 loc) · 3.41 KB
/
example_game_lazy_release.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
107
on:
push:
tags:
- "example_game_lazy-v*"
env:
# update with the name of the main binary
binary: example_game_lazy
add_binaries_to_github_release: true
itch_target: vrixyz/backpack-game-example
jobs:
# Build for wasm
release-wasm:
runs-on: ubuntu-latest
steps:
- uses: little-core-labs/get-git-tag@v3.0.1
id: get_version
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: install wasm-bindgen-cli
run: |
cargo install wasm-bindgen-cli
- name: Build
env:
JORNET_ID: ${{ secrets.JORNET_ID }}
JORNET_SECRET: ${{ secrets.JORNET_SECRET }}
BACKPACK_GAME_EXAMPLE_USERNAME: ""
BACKPACK_GAME_EXAMPLE_PASSWORD: ""
BACKPACK_SERVER_BASE_URL: ${{ secrets.BACKPACK_SERVER_BASE_URL }}
run: |
touch .env
cargo build --bin ${{ env.binary }} --profile wasm-release --target wasm32-unknown-unknown
- name: Prepare package
working-directory: ./crates/${{ env.binary }}
run: |
cp -r wasm ../../
wasm-bindgen --no-typescript --out-name bevy_game --out-dir ../../wasm --target web ../../target/wasm32-unknown-unknown/wasm-release/${{ env.binary }}.wasm
cp -r assets ../../wasm/
- name: Package as a zip
working-directory: ./wasm
run: |
zip --recurse-paths ../${{ env.binary }}.zip .
- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.zip
name: wasm
- name: Upload binaries to release
if: ${{ env.add_binaries_to_github_release == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.zip
asset_name: wasm-${{ steps.get_version.outputs.tag }}.zip
tag: ${{ github.ref }}
overwrite: true
check-if-upload-to-itch-is-configured:
runs-on: ubuntu-latest
outputs:
should-upload: ${{ steps.check-env.outputs.has-itch-target }}
steps:
- id: check-env
run: |
if [[ -z "$itch_target" ]]; then
echo "::set-output name=has-itch-target::no"
else
echo "::set-output name=has-itch-target::yes"
fi
upload-to-itch:
runs-on: ubuntu-latest
needs:
- check-if-upload-to-itch-is-configured
- release-wasm
if: ${{ needs.check-if-upload-to-itch-is-configured.outputs.should-upload == 'yes' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./builds
- name: Install 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
- uses: little-core-labs/get-git-tag@v3.0.1
id: get_version
- name: Upload to itch.io
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }}
run: |
for channel in $(ls builds); do
./butler push \
--fix-permissions \
--userversion="${{ steps.get_version.outputs.tag }}" \
builds/$channel/* \
${{ env.itch_target }}:$channel
done