Skip to content

Commit

Permalink
tweak: remove deploy and attempt unity build for remote project
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Feb 17, 2024
1 parent bb72fc8 commit f9c949e
Showing 1 changed file with 130 additions and 12 deletions.
142 changes: 130 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: build <unity project name>
name: project builder

on:
workflow_dispatch:
inputs:
project_path:
type: string
description: path to github project in format `<owner>/<repo>`
description: path to github project, in format <owner>/<repo>
required: true

permissions:
Expand All @@ -21,20 +21,138 @@ jobs:
build:
name: ${{ matrix.targetPlatform }} build
runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# targetPlatform:
# - StandaloneWindows64
# - StandaloneLinux64
# - WebGL
# outputs:
# release: ${{ steps.release.outputs.test }}
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneWindows64
- StandaloneLinux64
- WebGL
outputs:
release: ${{ steps.release.outputs.test }}
steps:
- name: clone remote project
- name: clone project
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.project_path }}
lfs: true
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}

- name: upload webgl template
uses: actions/upload-artifact@v3
if: matrix.targetPlatform == 'WebGL' && startsWith(github.ref, 'refs/tags/v')
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@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}

- name: archive ${{ matrix.targetPlatform }} release
if: startsWith(github.ref, 'refs/tags/v')
run: cd build/${{ matrix.targetPlatform }} && zip -r ../../neebo-${{ github.ref_name }}-${{ matrix.targetPlatform }}.zip .

- name: publish ${{ matrix.targetPlatform }} release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
id: release
with:
files: neebo-${{ github.ref_name }}-${{ matrix.targetPlatform }}.zip

- name: write matrix outputs
uses: cloudposse/github-action-matrix-outputs-write@main
if: startsWith(github.ref, 'refs/tags/v')
id: out
with:
matrix-step-name: release
matrix-key: ${{ matrix.targetPlatform }}
outputs: |-
releases: ${{ steps.release.outputs.assets }}
read:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: read matrix outputs
uses: cloudposse/github-action-matrix-outputs-read@main
id: read
with:
matrix-step-name: release
outputs:
result: ${{ steps.read.outputs.result }}

# deploy:
# needs: read
# runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/v')
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# steps:
# - name: download webgl build
# uses: actions/download-artifact@v3
# 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@v3
# with:
# name: WebGL-Template
# path: .
#
# - name: get commit hash
# id: get-commit
# uses: pr-mpt/actions-commit-hash@v2
#
# - name: substitute env on index.html
# uses: danielr1996/[email protected]
# 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.get-commit.outputs.short }}
# BUILD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
# with:
# input: ./index.html
# output: ./index.html
#
# - name: configure pages
# uses: actions/configure-pages@v2
#
# - name: upload pages build artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: .
#
# - name: deploy pages
# id: deployment
# uses: actions/deploy-pages@v1

0 comments on commit f9c949e

Please sign in to comment.