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 😎
on:
pull_request: {}
push: { branches: [master] }
jobs:
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 }}
PROJECT_PATH: test-project
# 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: ""
jobs:
checkout:
name: Checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Upload distributables
- name: Upload Build
uses: actions/upload-artifact@v1
with:
name: Build
path: ${{ steps.buildStep.outputs.allBuildsPath }}
activate:
name: Activate Unity
runs-on: ubuntu-latest
steps:
- uses: webbertakken/unity-activate@v1
# Return license
- name: Return License
uses: webbertakken/unity-return-license@v1
test:
name: Test the project
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()
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 "maintainer"="Webber Takken <webber@takken.io>"
ENV BUILD_TARGET=WebGL
ADD default-build-script /UnityBuilderAction
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

View File

@ -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'

View File

@ -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
#