Skip to content

Modified package.json generation #22

Modified package.json generation

Modified package.json generation #22

name: Build Unity Package
# Controls when the action will run. Triggers the workflow on pushing changes to develop that include
# updating the 'VersionConstants.cs' since this asset will change only on a new version
on:
push:
branches: [ develop ]
paths:
- 'Unity/Assets/JCMG/PackageTools/Scripts/Editor/VersionConstants.cs'
# 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@v4
with:
ref: 'develop'
path: './package_source'
fetch-depth: 0
- uses: actions/checkout@v4
with:
ref: 'release/stable'
path: './package_source_release'
fetch-depth: 0
# Retrieve cache for Unity project
- name: Retrieve Unity Library Cache
uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('./package_source/Unity/Assets/**', './package_source/Unity/Packages/**', './package_source/Unity/ProjectSettings/**') }}
restore-keys: |
Library-
# Install GitVersion
#- name: Install GitVersion
# uses: gittools/actions/gitversion/[email protected]
# 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
# Execute Unity Unit Tests and Upload results
# - name: Run Unity Unit Tests
# 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'
# unityVersion: 6000.0.28f1
# - name: Upload Unit Test Results
# uses: actions/upload-artifact@v4
# with:
# name: Test results
# path: artifacts
# Build Unity Package on Develop branch
- name: Execute Unity Package Build
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'
unityVersion: 6000.0.28f1
buildMethod: 'JCMG.PackageTools.Editor.PackageToolsCI.Generate'
allowDirtyBuild: true
# Check in Unity Package on Release branch
- name: Add & Commit Release Changes
uses: EndBug/add-and-commit@v9
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: 'Auto-updated package contents'
# Tag commit just made with new Unity package version and push it to remote for release/stable
# - name: Create Tag
# run: |
# cd './package_source'
# git config --global user.email "[email protected]"
# 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_release'
# git config --global user.email "[email protected]"
# git config --global user.name "Github Action Bot"
# git tag -a "v${{ env.GitVersion_MajorMinorPatch }}" -m "v${{ env.GitVersion_MajorMinorPatch }}"
# git push origin --tags