-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (175 loc) · 5.65 KB
/
Copy pathrelease.yml
File metadata and controls
190 lines (175 loc) · 5.65 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
on:
push:
branches:
- main
name: Release
env:
CARGO_TERM_COLOR: always
jobs:
build-apk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
override: true
target: aarch64-linux-android
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-ndk
run: cargo install --locked cargo-ndk
- name: Build Native Library
run: cargo ndk -t arm64-v8a -o app/src/main/jniLibs build --package solitaire-game --release
- name: Assemble Apk
run: |
./gradlew assemble
cp app/build/outputs/apk/release/app-release.apk peg-solitaire.apk
- uses: actions/upload-artifact@v6
with:
name: android-apk
path: ./peg-solitaire.apk
build-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
override: true
target: wasm32-unknown-unknown
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Cache wasm-bindgen-cli
id: cache-wasm-bindgen
uses: actions/cache@v5
with:
path: ~/.cargo/bin/wasm-bindgen
key: wasm-bindgen-${{ hashFiles('Cargo.lock') }}
- name: Install Bindgen
if: steps.cache-wasm-bindgen.outputs.cache-hit != 'true'
run: |
WASM_BINDGEN_VERSION=$(cargo metadata --format-version 1 | \
jq -r '.packages[] | select(.name == "wasm-bindgen") | .version')
cargo install wasm-bindgen-cli --version $WASM_BINDGEN_VERSION
- name: Install Binaryen
run: sudo apt install binaryen
- name: Install Brotli
run: sudo apt install brotli
- name: Build WASM dist
run: make
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: wasm-dist
path: www/
- name: Upload github pages artifact
id: deployment
uses: actions/upload-pages-artifact@v4
with:
path: www/
build-linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
override: true
target: wasm32-unknown-unknown
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libxkbcommon-dev
- name: release build
run: |
cargo build --release
cp target/release/peg-solitaire peg-solitaire-linux-x86_64
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: peg-solitaire-linux-x86_64
path: peg-solitaire-linux-x86_64
build-macos-aarch64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
override: true
target: wasm32-unknown-unknown
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: release build
run: |
cargo build --release
cp target/release/peg-solitaire peg-solitaire-macos-aarch64
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: peg-solitaire-macos-aarch64
path: peg-solitaire-macos-aarch64
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
override: true
target: wasm32-unknown-unknown
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: release build
run: |
cargo build --release
cp target/release/peg-solitaire.exe peg-solitaire-windows-x86_64.exe
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: peg-solitaire-windows-x86_64
path: peg-solitaire-windows-x86_64.exe
release:
needs: [build-apk, build-wasm, build-linux-x86_64, build-macos-aarch64, build-windows]
permissions:
contents: write
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v8
- name: Zip WASM dist
run: zip -r wasm-dist.zip wasm-dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.event.inputs.name || github.ref_name }}
name: ${{ github.event.inputs.name || github.ref_name }}
files: |
android-apk/peg-solitaire.apk
wasm-dist.zip
peg-solitaire-linux-x86_64/peg-solitaire-linux-x86_64
peg-solitaire-windows-x86_64/peg-solitaire-windows-x86_64.exe
peg-solitaire-macos-aarch64/peg-solitaire-macos-aarch64
generate_release_notes: true # Auto-generates changelog
draft: false
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') }}
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build-wasm]
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4