Change workflow and variables to allow multiple build jobs

This commit is contained in:
Webber 2019-12-14 17:12:13 +01:00 committed by Webber Takken
parent e9496f5ba2
commit 9a21280b09
4 changed files with 57 additions and 39 deletions

View File

@ -1,46 +1,65 @@
name: Actions 😎 name: Actions 😎
on: on:
pull_request: {} pull_request: {}
push: { branches: [master] } push: { branches: [master] }
jobs: env:
buildForWebGL:
name: Build for WebGL 🕸
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
# Activate license
- name: Activate license
uses: webbertakken/unity-activate@v1
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
PROJECT_PATH: test-project
# Configure builder jobs:
- name: Build project checkout:
id: buildStep name: Checkout
uses: webbertakken/unity-builder@${{ matrix.version }} runs-on: ubuntu-latest
env: steps:
UNITY_PROJECT_PATH: test-project - uses: actions/checkout@v1
BUILD_NAME: TestBuild
BUILD_TARGET: WebGL
BUILDS_PATH: builds
BUILD_METHOD: ""
# Upload distributables activate:
- name: Upload Build name: Activate Unity
uses: actions/upload-artifact@v1 runs-on: ubuntu-latest
with: steps:
name: Build - uses: webbertakken/unity-activate@v1
path: ${{ steps.buildStep.outputs.allBuildsPath }}
# Return license test:
- name: Return License name: Test the project
uses: webbertakken/unity-return-license@v1 needs: [checkout, activate]
runs-on: ubuntu-latest
steps:
- uses: webbertakken/unity-test-runner@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() if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v1
with:
name: Builds
path: builds
returnTheLicense:
name: Return the license
needs: [uploadBuildArtifacts]
if: always()
runs-on: ubuntu-latest
steps:
- uses: webbertakken/unity-return-license@v1

View File

@ -9,6 +9,8 @@ LABEL "repository"="http://github.com/webbertakken/unity-actions"
LABEL "homepage"="http://github.com/webbertakken/unity-actions" LABEL "homepage"="http://github.com/webbertakken/unity-actions"
LABEL "maintainer"="Webber Takken <webber@takken.io>" LABEL "maintainer"="Webber Takken <webber@takken.io>"
ENV BUILD_TARGET=WebGL
ADD default-build-script /UnityBuilderAction ADD default-build-script /UnityBuilderAction
ADD entrypoint.sh /entrypoint.sh ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh

View File

@ -5,8 +5,6 @@ inputs: {}
outputs: outputs:
buildPath: buildPath:
description: "Path where the current platform has been built to." 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: runs:
using: 'docker' using: 'docker'
image: 'Dockerfile' image: 'Dockerfile'

View File

@ -1,17 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Set project path # Set project path (configured with "with: { project: somepath }"
# #
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$UNITY_PROJECT_PATH
# #
# Set the name for the build # Set the name for the build
# #
if [ -z "$BUILD_NAME" ]; then if [ -z "$BUILD_NAME" ]; then
BUILD_NAME=buildName BUILD_NAME="build-$(date '+%F-%H%M')"
fi fi
# #