ci: use action to avoid rate limiting (#3950)

This commit is contained in:
Siyuan Yan 2025-11-27 14:25:03 +09:00 committed by GitHub
parent 71e24b7e81
commit 54c20db6cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 1 deletions

View File

@ -32,8 +32,18 @@ jobs:
with:
version: 'latest'
- name: Get latest wasm-opt version
id: wasm-opt
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: WebAssembly/binaryen
excludes: prerelease, draft
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build examples
run: cargo run -p build-examples --bin build-examples
env:
LATEST_WASM_OPT_VERSION: ${{ steps.wasm-opt.outputs.release }}
- name: Deploy to Firebase
uses: siku2/action-hosting-deploy@v1

View File

@ -59,8 +59,18 @@ jobs:
with:
version: "latest"
- name: Get latest wasm-opt version
id: wasm-opt
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: WebAssembly/binaryen
excludes: prerelease, draft
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build examples
run: cargo run -p build-examples --bin build-examples
env:
LATEST_WASM_OPT_VERSION: ${{ steps.wasm-opt.outputs.release }}
- name: Collect size information
run: python3 ci/collect_sizes.py

View File

@ -1,5 +1,5 @@
use std::fs;
use std::path::Path;
use std::{env, fs};
use serde::Deserialize;
use toml::Table;
@ -13,6 +13,16 @@ struct GitHubRelease {
}
pub fn get_latest_wasm_opt_version() -> String {
if let Ok(version) = env::var("LATEST_WASM_OPT_VERSION") {
if !version.is_empty() {
return version;
}
}
get_latest_wasm_opt_version_from_api()
}
fn get_latest_wasm_opt_version_from_api() -> String {
let url = "https://api.github.com/repos/WebAssembly/binaryen/releases/latest";
let client = reqwest::blocking::Client::new();