Skip to content

Commit 54c20db

Browse files
ci: use action to avoid rate limiting (yewstack#3950)
1 parent 71e24b7 commit 54c20db

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.github/workflows/publish-examples.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,18 @@ jobs:
3232
with:
3333
version: 'latest'
3434

35+
- name: Get latest wasm-opt version
36+
id: wasm-opt
37+
uses: pozetroninc/github-action-get-latest-release@master
38+
with:
39+
repository: WebAssembly/binaryen
40+
excludes: prerelease, draft
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
3543
- name: Build examples
3644
run: cargo run -p build-examples --bin build-examples
45+
env:
46+
LATEST_WASM_OPT_VERSION: ${{ steps.wasm-opt.outputs.release }}
3747

3848
- name: Deploy to Firebase
3949
uses: siku2/action-hosting-deploy@v1

.github/workflows/size-cmp.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,18 @@ jobs:
5959
with:
6060
version: "latest"
6161

62+
- name: Get latest wasm-opt version
63+
id: wasm-opt
64+
uses: pozetroninc/github-action-get-latest-release@master
65+
with:
66+
repository: WebAssembly/binaryen
67+
excludes: prerelease, draft
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
6270
- name: Build examples
6371
run: cargo run -p build-examples --bin build-examples
72+
env:
73+
LATEST_WASM_OPT_VERSION: ${{ steps.wasm-opt.outputs.release }}
6474

6575
- name: Collect size information
6676
run: python3 ci/collect_sizes.py

tools/build-examples/src/lib.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::fs;
21
use std::path::Path;
2+
use std::{env, fs};
33

44
use serde::Deserialize;
55
use toml::Table;
@@ -13,6 +13,16 @@ struct GitHubRelease {
1313
}
1414

1515
pub fn get_latest_wasm_opt_version() -> String {
16+
if let Ok(version) = env::var("LATEST_WASM_OPT_VERSION") {
17+
if !version.is_empty() {
18+
return version;
19+
}
20+
}
21+
22+
get_latest_wasm_opt_version_from_api()
23+
}
24+
25+
fn get_latest_wasm_opt_version_from_api() -> String {
1626
let url = "https://api.github.com/repos/WebAssembly/binaryen/releases/latest";
1727
let client = reqwest::blocking::Client::new();
1828

0 commit comments

Comments
 (0)