From 9a21280b097288a773c222b20b56fe08bd1ebd5a Mon Sep 17 00:00:00 2001 From: Webber Date: Sat, 14 Dec 2019 17:12:13 +0100 Subject: [PATCH] Change workflow and variables to allow multiple build jobs --- .github/workflows/main.yml | 85 +++++++++++++++++++++++--------------- Dockerfile | 2 + action.yml | 2 - entrypoint.sh | 7 ++-- 4 files changed, 57 insertions(+), 39 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a0b2dd13..cbf324e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,46 +1,65 @@ name: Actions 😎 + on: pull_request: {} push: { branches: [master] } +env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + PROJECT_PATH: test-project + jobs: - buildForWebGL: - name: Build for WebGL 🕸 + checkout: + name: Checkout runs-on: ubuntu-latest - strategy: - matrix: - version: [v0.1, v0.2] - steps: - # Checkout repository (required to test local actions) - - name: Checkout repository - uses: actions/checkout@v1 + - uses: actions/checkout@v1 - # Activate license - - name: Activate license - uses: webbertakken/unity-activate@v1 - env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + activate: + name: Activate Unity + runs-on: ubuntu-latest + steps: + - uses: webbertakken/unity-activate@v1 - # Configure builder - - name: Build project - id: buildStep - uses: webbertakken/unity-builder@${{ matrix.version }} - env: - UNITY_PROJECT_PATH: test-project - BUILD_NAME: TestBuild - BUILD_TARGET: WebGL - BUILDS_PATH: builds - BUILD_METHOD: "" + test: + name: Test the project + needs: [checkout, activate] + runs-on: ubuntu-latest + steps: + - uses: webbertakken/unity-test-runner@v1 - # Upload distributables - - name: Upload Build - uses: actions/upload-artifact@v1 + buildForWebGL: + name: Build for WebGL + needs: [test] + runs-on: ubuntu-latest + steps: # webbertakken/unity-builder@v0.3-webgl + - uses: ./ + + + buildForAndroid: + name: Build for Android + needs: [test] + runs-on: ubuntu-latest + steps: # webbertakken/unity-builder@v0.3-android + - uses: ./ + + uploadBuildArtifacts: + name: Upload Build Artifacts + needs: + - buildForWebGL + - buildForAndroid + if: always() + runs-on: ubuntu-latest + steps: + - uses: actions/upload-artifact@v1 with: - name: Build - path: ${{ steps.buildStep.outputs.allBuildsPath }} + name: Builds + path: builds - # Return license - - name: Return License - uses: webbertakken/unity-return-license@v1 - if: always() + returnTheLicense: + name: Return the license + needs: [uploadBuildArtifacts] + if: always() + runs-on: ubuntu-latest + steps: + - uses: webbertakken/unity-return-license@v1 diff --git a/Dockerfile b/Dockerfile index 03aef9a5..d8fea678 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ LABEL "repository"="http://github.com/webbertakken/unity-actions" LABEL "homepage"="http://github.com/webbertakken/unity-actions" LABEL "maintainer"="Webber Takken " +ENV BUILD_TARGET=WebGL + ADD default-build-script /UnityBuilderAction ADD entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/action.yml b/action.yml index 23770c29..9ebbd4be 100644 --- a/action.yml +++ b/action.yml @@ -5,8 +5,6 @@ inputs: {} outputs: buildPath: description: "Path where the current platform has been built to." - allBuildsPath: - description: "Path where the build folders are stored. Each platform creates a folder within it." runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 8840c072..34158797 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,17 +1,16 @@ #!/usr/bin/env bash # -# Set project path +# Set project path (configured with "with: { project: somepath }" # - -UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$UNITY_PROJECT_PATH +UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH # # Set the name for the build # if [ -z "$BUILD_NAME" ]; then - BUILD_NAME=buildName + BUILD_NAME="build-$(date '+%F-%H%M')" fi #