From fe6320926897b29100f1a3c9be027464c0a12202 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:32:59 -0500 Subject: [PATCH] fix: git commit and message in webgl build --- .github/workflows/build.yml | 201 ++++++++++++++++++------------------ 1 file changed, 98 insertions(+), 103 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef7b1a2..439995f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,56 +61,56 @@ jobs: echo "commit_message=$(git log -1 --pretty=%B)" >> "$GITHUB_OUTPUT" echo "commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - # - name: free disk space - # run: | - # sudo swapoff -a - # sudo rm -f /swapfile - # sudo apt clean - # docker rmi $(docker image ls -aq) - # df -h - - # - name: upload webgl template - # uses: actions/upload-artifact@v4 - # if: matrix.targetPlatform == 'WebGL' - # with: - # name: WebGL-Template - # path: WebGL - - # - name: cache Library - # uses: actions/cache@v3 - # with: - # path: Library - # key: Library-${{ matrix.targetPlatform }} - # restore-keys: Library-${{ matrix.targetPlatform }} - - # - name: build project for ${{ matrix.targetPlatform }} - # uses: game-ci/unity-builder@v4 - # env: - # UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - # UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - # UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - # with: - # targetPlatform: ${{ matrix.targetPlatform }} - - # - name: upload ${{ matrix.targetPlatform }} build - # uses: actions/upload-artifact@v4 - # id: upload - # with: - # name: Build-${{ matrix.targetPlatform }} - # path: build/${{ matrix.targetPlatform }} - - # - name: archive ${{ matrix.targetPlatform }} release - # run: cd build/${{ matrix.targetPlatform }} && zip -r ../../neebo-${{ matrix.targetPlatform }}.zip . - - # - name: publish ${{ matrix.targetPlatform }} pre-release - # uses: softprops/action-gh-release@v1 - # id: release - # with: - # prerelease: true - # name: ${{ github.event.inputs.repository }}-${{ matrix.targetPlatform }} - # tag_name: ${{ github.event.inputs.repository }}-${{ matrix.targetPlatform }} - # files: neebo-${{ matrix.targetPlatform }}.zip - # fail_on_unmatched_files: true + - name: free disk space + run: | + sudo swapoff -a + sudo rm -f /swapfile + sudo apt clean + docker rmi $(docker image ls -aq) + df -h + + - name: upload webgl template + uses: actions/upload-artifact@v4 + if: matrix.targetPlatform == 'WebGL' + with: + name: WebGL-Template + path: WebGL + + - name: cache Library + uses: actions/cache@v3 + with: + path: Library + key: Library-${{ matrix.targetPlatform }} + restore-keys: Library-${{ matrix.targetPlatform }} + + - name: build project for ${{ matrix.targetPlatform }} + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: ${{ matrix.targetPlatform }} + + - name: upload ${{ matrix.targetPlatform }} build + uses: actions/upload-artifact@v4 + id: upload + with: + name: Build-${{ matrix.targetPlatform }} + path: build/${{ matrix.targetPlatform }} + + - name: archive ${{ matrix.targetPlatform }} release + run: cd build/${{ matrix.targetPlatform }} && zip -r ../../neebo-${{ matrix.targetPlatform }}.zip . + + - name: publish ${{ matrix.targetPlatform }} pre-release + uses: softprops/action-gh-release@v1 + id: release + with: + prerelease: true + name: ${{ github.event.inputs.repository }}-${{ matrix.targetPlatform }} + tag_name: ${{ github.event.inputs.repository }}-${{ matrix.targetPlatform }} + files: neebo-${{ matrix.targetPlatform }}.zip + fail_on_unmatched_files: true - name: write matrix outputs uses: cloudposse/github-action-matrix-outputs-write@main @@ -150,57 +150,52 @@ jobs: ref: gh-pages token: ${{ secrets.PAT_TOKEN }} - # - name: clear existing content - # run: | - # mv .git ../.git - # rm -rf * - # mv ../.git .git - - # - name: download webgl build - # uses: actions/download-artifact@v4 - # with: - # name: Build-WebGL - # path: . - - # - name: unpack webgl build - # run: | - # ls -lar . - # ls -lar WebGL - # cp -r WebGL/Build . - # rm -rf WebGL - - # - name: download webgl template - # uses: actions/download-artifact@v4 - # with: - # name: WebGL-Template - # path: . - - - name: check env + - name: clear existing content + run: | + mv .git ../.git + rm -rf * + mv ../.git .git + + - name: download webgl build + uses: actions/download-artifact@v4 + with: + name: Build-WebGL + path: . + + - name: unpack webgl build run: | - echo "${{ fromJson(needs.read.outputs.result).commit_hash.WebGL }}" - echo "${{ fromJson(needs.read.outputs.result).commit_message.WebGL }}" - - # - name: substitute env on index.html - # uses: danielr1996/envsubst-action@1.1.0 - # env: - # LINUX_BUILD_LINK: ${{ fromJson(needs.read.outputs.result).releases.StandaloneLinux64[0].browser_download_url }} - # WINDOWS_BUILD_LINK: ${{ fromJson(needs.read.outputs.result).releases.StandaloneWindows64[0].browser_download_url }} - # BUILD_COMMIT: ${{ steps.git.outputs.commit_hash }} - # BUILD_COMMIT_MESSAGE: ${{ steps.git.outputs.commit_message }} - # with: - # input: ./index.html - # output: ./index.html - - # - name: commit static site - # run: | - # git config user.name github-actions - # git config user.email github-actions@github.com - # git add . - # git commit -m "publishing static site" - - # - name: push static site to ${{ github.event.inputs.repository }} on gh-pages - # uses: ad-m/github-push-action@master - # with: - # repository: ${{ github.event.inputs.repository }} - # branch: ${{ github.event.inputs.pages-deploy-branch || 'gh-pages' }} - # github_token: ${{ secrets.PAT_TOKEN }} + ls -lar . + ls -lar WebGL + cp -r WebGL/Build . + rm -rf WebGL + + - name: download webgl template + uses: actions/download-artifact@v4 + with: + name: WebGL-Template + path: . + + - name: substitute env on index.html + uses: danielr1996/envsubst-action@1.1.0 + env: + LINUX_BUILD_LINK: ${{ fromJson(needs.read.outputs.result).releases.StandaloneLinux64[0].browser_download_url }} + WINDOWS_BUILD_LINK: ${{ fromJson(needs.read.outputs.result).releases.StandaloneWindows64[0].browser_download_url }} + BUILD_COMMIT: "${{ fromJson(needs.read.outputs.result).commit_hash.WebGL }}" + BUILD_COMMIT_MESSAGE: "${{ fromJson(needs.read.outputs.result).commit_message.WebGL }}" + with: + input: ./index.html + output: ./index.html + + - name: commit static site + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "publishing static site" + + - name: push static site to ${{ github.event.inputs.repository }} on gh-pages + uses: ad-m/github-push-action@master + with: + repository: ${{ github.event.inputs.repository }} + branch: ${{ github.event.inputs.pages-deploy-branch || 'gh-pages' }} + github_token: ${{ secrets.PAT_TOKEN }}