Skip to content

Fixing issues with package workflow file #15

Fixing issues with package workflow file

Fixing issues with package workflow file #15

name: Continous Deployment
# Controls when the action will run.
on:
push:
branches: [ develop ]
paths:
- '.github/workflows/publish_release.yml'
- 'Unity/Assets/JCMG/Utility/Scripts/**/*.cs'
- 'Unity/Assets/PackageManifests/PackageManifestConfig.asset'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
runs-on: ubuntu-latest
steps:
# Check out the 'develop' and 'release/stable' branch
- uses: actions/checkout@v2
with:
ref: 'develop'
path: './package_source'
lfs: true
fetch-depth: 0
- uses: actions/checkout@v2
with:
ref: 'release/stable'
path: './package_source_release'
lfs: true
fetch-depth: 0
# Install GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
## Install & Execute GitVersion
- name: Use GitVersion
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
dotnet-gitversion package_source /config GitVersion.yml /output buildserver /nonormalize /updateassemblyinfo /ensureassemblyinfo /diag /verbosity Diagnostic
# Retrieve cache for Unity project
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ hashFiles('Unity/Library/**', 'Unity/Packages/**') }}
restore-keys: |
Library-
# Execute Unity Unit Tests and Upload results
- name: Unity - Test runner
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: './package_source/Unity'
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Unit Test Results
uses: actions/upload-artifact@v1
with:
name: Test results
path: artifacts
# Build Unity Package on Develop branch
- name: Unity - Builder
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: './package_source/Unity'
buildMethod: 'JCMG.PackageTools.Editor.PackageToolsCI.Generate'
allowDirtyBuild: true
targetPlatform: StandaloneOSX
customParameters: version=${{ env.GitVersion_MajorMinorPatch }} GenerateVersionConstants=true
# Check in Unity Package on Release branch
- name: Add & Commit Release Changes
uses: EndBug/add-and-commit@v5.1.0
env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
with:
author_name: Github Action Bot
cwd: './package_source_release'
branch: 'release/stable'
message: v${{ env.GitVersion_MajorMinorPatch }}
# Tag commit just made with new Unity package version and push it to remote for release/stable
- name: Create Tag
run: |
cd './package_source_release'
git config --global user.email "mirraraenn@gmail.com"
git config --global user.name "Github Action Bot"
git tag -a "upm/v${{ env.GitVersion_MajorMinorPatch }}" -m "v${{ env.GitVersion_MajorMinorPatch }}"
git push origin --tags
# Tag commit just made with new Unity package version and push it to remote for develop
- name: Create Tag
run: |
cd './package_source'
git config --global user.email "mirraraenn@gmail.com"
git config --global user.name "Github Action Bot"
git tag -a "v${{ env.GitVersion_MajorMinorPatch }}" -m "v${{ env.GitVersion_MajorMinorPatch }}"
git push origin --tags