diff --git a/.github/workflows/build-wasm-examples.yml b/.github/workflows/build-wasm-examples.yml index 2d73e63d2b..34bd4ede87 100644 --- a/.github/workflows/build-wasm-examples.yml +++ b/.github/workflows/build-wasm-examples.yml @@ -7,13 +7,30 @@ env: PER_PAGE: 50 jobs: + prepare-pages: + name: Get Environment + runs-on: ubuntu-latest + outputs: + pages: ${{ steps.env.outputs.pages }} + steps: + - name: Checkout Bevy main branch + uses: actions/checkout@v4 + with: + repository: 'bevyengine/bevy' + ref: 'latest' + - name: Get Environment + id: env + run: | + example_count=`cat Cargo.toml | grep 'wasm = true' | wc -l` + page_count=$((example_count / ${{ env.PER_PAGE }} + 1)) + wasm-examples: name: Build WASM Examples + needs: prepare-pages runs-on: macos-latest strategy: matrix: - # if all examples are not built, add a new page here - page: [0, 1, 2] + page: ${{ fromJSON(needs.prepare-pages.outputs.pages) }} api: [webgl2, webgpu] steps: diff --git a/.github/workflows/update-screenshots.yml b/.github/workflows/update-screenshots.yml index b7095bf710..b5f0646f52 100644 --- a/.github/workflows/update-screenshots.yml +++ b/.github/workflows/update-screenshots.yml @@ -7,13 +7,31 @@ env: PER_PAGE: 20 jobs: + prepare-pages: + name: Get Environment + runs-on: ubuntu-latest + outputs: + pages: ${{ steps.env.outputs.pages }} + steps: + - name: Checkout Bevy main branch + uses: actions/checkout@v4 + with: + repository: 'bevyengine/bevy' + ref: 'latest' + - name: Get Environment + id: env + run: | + example_count=`cat Cargo.toml | grep '\[\[example\]\]' | wc -l` + page_count=$((example_count / ${{ env.PER_PAGE }} + 1)) + + take-screenshots: name: Take Screenshots + needs: prepare-pages runs-on: ubuntu-latest strategy: matrix: - # if all examples are not built, add a new page here - page: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + page: ${{ fromJSON(needs.prepare-pages.outputs.pages) }} steps: - name: Checkout Bevy latest tag