From d00d46e15f6b258a58f57d4384d85a5c32dc7af3 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 17:49:03 -0500 Subject: [PATCH 01/13] test: select steps with matrix outputs --- .github/workflows/build.yml | 207 ++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 101 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea34969..e6fb5ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,59 +57,59 @@ jobs: - name: write git info id: git run: | - echo ::set-output name=commit_message::$(git log -1 --pretty=%B) - echo ::set-output name=commit_hash::$(git rev-parse --short HEAD) - - - 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 + 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: write matrix outputs uses: cloudposse/github-action-matrix-outputs-write@main @@ -145,52 +145,57 @@ jobs: ref: gh-pages token: ${{ secrets.PAT_TOKEN }} - - name: clear existing content + # - 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 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: 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 }} + echo ${{ steps.git.outputs.commit_hash }} + echo ${{ steps.git.outputs.commit_message }} + + # - 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 }} From 7f6d18bea3b65995a36ec2c2abfb1b4461d548d0 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 17:56:11 -0500 Subject: [PATCH 02/13] test: try with matrix write read --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6fb5ae..76db32b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,6 +59,7 @@ jobs: run: | echo "{commit_message}={$(git log -1 --pretty=%B)}" >> $GITHUB_OUTPUT echo "{commit_hash}={$(git rev-parse --short HEAD)}" >> $GITHUB_OUTPUT + echo "{foo}={bar}" >> $GITHUB_OUTPUT # - name: free disk space # run: | @@ -119,6 +120,7 @@ jobs: matrix-key: ${{ matrix.targetPlatform }} outputs: |- releases: ${{ steps.release.outputs.assets }} + git: ${{ steps.git.outputs.foo }} read: runs-on: ubuntu-latest @@ -172,8 +174,7 @@ jobs: - name: check env run: | - echo ${{ steps.git.outputs.commit_hash }} - echo ${{ steps.git.outputs.commit_message }} + echo ${{ fromJson(needs.read.outputs.result).git.StandaloneWindows64.foo }} # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From 8446018293d3f1fc62a588553a961f02ad474ad2 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 17:58:43 -0500 Subject: [PATCH 03/13] test: try with matrix write read --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76db32b..d3cb369 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,9 +57,9 @@ jobs: - name: write git info id: git run: | - echo "{commit_message}={$(git log -1 --pretty=%B)}" >> $GITHUB_OUTPUT - echo "{commit_hash}={$(git rev-parse --short HEAD)}" >> $GITHUB_OUTPUT - echo "{foo}={bar}" >> $GITHUB_OUTPUT + echo "commit_message=$(git log -1 --pretty=%B)" >> "$GITHUB_OUTPUT" + echo "commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + echo "foo=bar" >> $GITHUB_OUTPUT # - name: free disk space # run: | From de7576d5df23099666da1abc3d4bc21d976bfc7a Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:02:02 -0500 Subject: [PATCH 04/13] test: try with matrix write read --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3cb369..9d19329 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,7 +174,8 @@ jobs: - name: check env run: | - echo ${{ fromJson(needs.read.outputs.result).git.StandaloneWindows64.foo }} + echo ${{ fromJson(needs.read.outputs.result) }} + echo ${{ steps.git.outputs.foo }} # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From 9a115db74e8e427bfe545b2aae31d383357412d4 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:07:01 -0500 Subject: [PATCH 05/13] test: try with matrix write read --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d19329..36e87e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -134,6 +134,7 @@ jobs: matrix-step-name: release outputs: result: ${{ steps.read.outputs.result }} + git: ${{ steps.read.outputs.git }} deploy: needs: read @@ -174,7 +175,7 @@ jobs: - name: check env run: | - echo ${{ fromJson(needs.read.outputs.result) }} + echo ${{ fromJson(needs.read.outputs.result).git }} echo ${{ steps.git.outputs.foo }} # - name: substitute env on index.html From 29ceee3b916ef1872e17d338ca0b0f99c126478f Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:08:39 -0500 Subject: [PATCH 06/13] test: try with matrix write read --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36e87e1..3643726 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: type: string description: path to github project, in format / required: true + default: plyr4/unity-ufo ref: type: string @@ -60,7 +61,10 @@ jobs: echo "commit_message=$(git log -1 --pretty=%B)" >> "$GITHUB_OUTPUT" echo "commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" echo "foo=bar" >> $GITHUB_OUTPUT - + - name: read git info + id: git-read + run: | + echo "${{ steps.git.outputs.foo }} # - name: free disk space # run: | # sudo swapoff -a @@ -176,7 +180,7 @@ jobs: - name: check env run: | echo ${{ fromJson(needs.read.outputs.result).git }} - echo ${{ steps.git.outputs.foo }} + echo ${{ fromJson(needs.read.outputs.result).git.foo }} # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From 5d20530a378c8f092b4e68b21a6458bbb11ecbab Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:09:59 -0500 Subject: [PATCH 07/13] test: try with matrix write read --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3643726..8bfad7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,7 +64,7 @@ jobs: - name: read git info id: git-read run: | - echo "${{ steps.git.outputs.foo }} + echo "${{ steps.git.outputs.foo }}" # - name: free disk space # run: | # sudo swapoff -a @@ -179,8 +179,8 @@ jobs: - name: check env run: | - echo ${{ fromJson(needs.read.outputs.result).git }} - echo ${{ fromJson(needs.read.outputs.result).git.foo }} + echo "${{ fromJson(needs.read.outputs.result).git }}" + echo "${{ fromJson(needs.read.outputs.result).git.foo }}" # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From a9f6a701b190ded9c2db4cfaf007b189e2ae371e Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:11:26 -0500 Subject: [PATCH 08/13] test: try with matrix write read --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bfad7d..633b10f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -179,8 +179,8 @@ jobs: - name: check env run: | - echo "${{ fromJson(needs.read.outputs.result).git }}" - echo "${{ fromJson(needs.read.outputs.result).git.foo }}" + echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64 }}" + echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.foo }}" # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From 037fc1325d33bc8f4fafc2ab847eba8d46519245 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:16:01 -0500 Subject: [PATCH 09/13] test: hash and message --- .github/workflows/build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 633b10f..6861a6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,10 +61,7 @@ jobs: echo "commit_message=$(git log -1 --pretty=%B)" >> "$GITHUB_OUTPUT" echo "commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" echo "foo=bar" >> $GITHUB_OUTPUT - - name: read git info - id: git-read - run: | - echo "${{ steps.git.outputs.foo }}" + # - name: free disk space # run: | # sudo swapoff -a @@ -124,7 +121,7 @@ jobs: matrix-key: ${{ matrix.targetPlatform }} outputs: |- releases: ${{ steps.release.outputs.assets }} - git: ${{ steps.git.outputs.foo }} + git: ${{ steps.git.outputs }} read: runs-on: ubuntu-latest @@ -181,6 +178,8 @@ jobs: run: | echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64 }}" echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.foo }}" + echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.commit_hash }}" + echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.commit_message }}" # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From 541b9d94e38ed81e604b155029b5c81a1e24a0a7 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:25:28 -0500 Subject: [PATCH 10/13] test: hash and message --- .github/workflows/build.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6861a6e..c1a6449 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,6 @@ jobs: run: | echo "commit_message=$(git log -1 --pretty=%B)" >> "$GITHUB_OUTPUT" echo "commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - echo "foo=bar" >> $GITHUB_OUTPUT # - name: free disk space # run: | @@ -121,7 +120,8 @@ jobs: matrix-key: ${{ matrix.targetPlatform }} outputs: |- releases: ${{ steps.release.outputs.assets }} - git: ${{ steps.git.outputs }} + commit_hash: ${{ steps.git.outputs.commit_hash }} + commit_message: ${{ steps.git.outputs.commit_message }} read: runs-on: ubuntu-latest @@ -135,7 +135,8 @@ jobs: matrix-step-name: release outputs: result: ${{ steps.read.outputs.result }} - git: ${{ steps.read.outputs.git }} + commit_hash: ${{ steps.read.outputs.commit_hash }} + commit_message: ${{ steps.read.outputs.commit_message }} deploy: needs: read @@ -176,10 +177,8 @@ jobs: - name: check env run: | - echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64 }}" - echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.foo }}" - echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.commit_hash }}" - echo "${{ fromJson(needs.read.outputs.result).git.StandaloneLinux64.commit_message }}" + echo "${{ fromJson(needs.read.outputs.result).commit_hash.StandaloneLinux64 }}" + echo "${{ fromJson(needs.read.outputs.result).commit_message.StandaloneLinux64 }}" # - name: substitute env on index.html # uses: danielr1996/envsubst-action@1.1.0 From 1d0402442908e19fbdb94e82e5b3c74d4e9bc3ed Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:27:17 -0500 Subject: [PATCH 11/13] test: hash and message --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1a6449..ad23d2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -135,8 +135,8 @@ jobs: matrix-step-name: release outputs: result: ${{ steps.read.outputs.result }} - commit_hash: ${{ steps.read.outputs.commit_hash }} - commit_message: ${{ steps.read.outputs.commit_message }} + commit_hash: "${{ steps.read.outputs.commit_hash }}" + commit_message: "${{ steps.read.outputs.commit_message }}" deploy: needs: read @@ -177,8 +177,8 @@ jobs: - name: check env run: | - echo "${{ fromJson(needs.read.outputs.result).commit_hash.StandaloneLinux64 }}" - echo "${{ fromJson(needs.read.outputs.result).commit_message.StandaloneLinux64 }}" + 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 From a70952366bf0ebf1e0b180773032f72f9d736a0e Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:29:18 -0500 Subject: [PATCH 12/13] test: hash and message --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad23d2b..ef7b1a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,8 +120,8 @@ jobs: matrix-key: ${{ matrix.targetPlatform }} outputs: |- releases: ${{ steps.release.outputs.assets }} - commit_hash: ${{ steps.git.outputs.commit_hash }} - commit_message: ${{ steps.git.outputs.commit_message }} + commit_hash: "${{ steps.git.outputs.commit_hash }}" + commit_message: "${{ steps.git.outputs.commit_message }}" read: runs-on: ubuntu-latest From fe6320926897b29100f1a3c9be027464c0a12202 Mon Sep 17 00:00:00 2001 From: plyr4 Date: Fri, 29 Mar 2024 18:32:59 -0500 Subject: [PATCH 13/13] 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 }}