-
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (101 loc) · 4.11 KB
/
publish_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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