Pass Unity credentials to WebGL build workflow #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy WebGL | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - Assets/** | |
| - Packages/** | |
| - ProjectSettings/** | |
| - web/** | |
| - README.md | |
| - .github/workflows/webgl-pages.yml | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: webgl-pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Build WebGL project | |
| uses: game-ci/unity-builder@v4 | |
| env: | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| with: | |
| unityVersion: auto | |
| targetPlatform: WebGL | |
| buildMethod: BuildScript.BuildWebGLForPages | |
| - name: Add .nojekyll marker | |
| run: touch Build/WebGL/.nojekyll | |
| - name: Prepare showcase site artifact | |
| run: | | |
| rm -rf site-dist | |
| mkdir -p site-dist/unity | |
| cp -R web/. site-dist/ | |
| cp -R Build/WebGL/. site-dist/unity/ | |
| touch site-dist/.nojekyll | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site-dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |