Fix CI/Docker #18
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
| # @see actions/cache https://github.com/actions/cache | |
| # @see actions/upload-artifact https://github.com/actions/upload-artifact | |
| name: Build | |
| on: [push] | |
| # Secret Environments | |
| # - BASE64_ULF | |
| # - AWS_ACCESS_KEY_ID | |
| # - AWS_SECRET_ACCESS_KEY | |
| # - UNITY_PACKAGES_BUCKET | |
| # - UNITY_PACKAGES_CACHE_PREFIX | |
| # - FIREBASE_PROJECT_ID | |
| # - FIREBASE_TOKEN | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: unityci/editor:ubuntu-6000.0.37f1-webgl-3.1 | |
| env: | |
| UNITY_CMD: /opt/unity/Editor/Unity | |
| ULF_FILE: Unity_v6000.x.ulf | |
| BASE64_ULF: ${{ secrets.BASE64_ULF }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| UNITY_PACKAGES_BUCKET: ${{ secrets.UNITY_PACKAGES_BUCKET }} | |
| UNITY_PACKAGES_CACHE_PREFIX: ${{ secrets.UNITY_PACKAGES_CACHE_PREFIX }} | |
| FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | |
| FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
| steps: | |
| # Checkout | |
| - uses: actions/checkout@v2 | |
| # Add PATH | |
| - run: echo "::add-path::${GITHUB_WORKSPACE}/bin" | |
| # Install middlewares/tools | |
| - name: Install basic packages | |
| run: | | |
| apt-get update | |
| apt-get install -y curl gettext | |
| - name: Install Node.js | |
| run: | | |
| npm install -g n | |
| n 12.16.3 | |
| - name: Install Ruby | |
| run: apt-get install -y ruby | |
| - name: Install ImageMagick | |
| run: apt-get install -y imagemagick | |
| - name: Install openupm | |
| run: npm install -g openupm-cli | |
| - name: Install aws-cli | |
| run: | | |
| cd /root | |
| curl "https://d1vvhvl2y92vvt.cloudfront.net/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip awscliv2.zip | |
| ./aws/install | |
| - name: Install firebase-tools | |
| run: npm install -g firebase-tools | |
| # Download Unity packages | |
| - name: Cache Unity packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: /root/unity-assets | |
| key: minecraft-clone-unity-packages-${{ secrets.UNITY_PACKAGES_CACHE_PREFIX }}-${{ hashFiles('Packages/asset.json') }} | |
| - name: Download unity packages | |
| run: download-unity-packages --bucket=${UNITY_PACKAGES_BUCKET} --output=/root/unity-assets | |
| # Build | |
| - name: Expand ULF file | |
| run: echo ${BASE64_ULF} | base64 -d > ${ULF_FILE} | |
| - name: Activation | |
| run: unity -manualLicenseFile ${ULF_FILE} || true | |
| - name: Import Assets | |
| run: unity -executeMethod ImportAssets.Import /basePath /root/unity-assets | |
| - name: Build | |
| run: unity -executeMethod Builder.BuildWebGL | |
| # Deploy to Firebase | |
| - name: Make .firebaserc | |
| run: make_firebaserc | |
| - name: Deploy to Firebase | |
| run: firebase deploy --token=${FIREBASE_TOKEN} | |
| # Upload Artifacts | |
| - uses: actions/upload-artifact@v2 | |
| with: | |
| name: minecraft-clone.webgl | |
| path: Build/minecraft-clone.webgl |