-
Notifications
You must be signed in to change notification settings - Fork 9
90 lines (72 loc) · 2.19 KB
/
release.yml
File metadata and controls
90 lines (72 loc) · 2.19 KB
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
name: release
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
- uses: git-actions/set-user@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
working-directory: ./UnityEditorPatch
run: |
buildFolder="build/"
targetFolder="./build/EditorPatch~"
dotnet publish UnityEditorPatch.csproj -c Release --no-self-contained -o $buildFolder
mkdir $targetFolder
mv ./build/UnityEditorPatch.dll $targetFolder
mv ./build/UnityEditorPatch.runtimeconfig.json $targetFolder
- name: Assemble Package
run: |
mkdir package
mv ./UnityEditorPatch/build/EditorPatch~ ./package
mv ./UnityCSharpPatch/Packages/com.kandreyc.unity-csharp-patch/** ./package
- name: Publish Artifacts
uses: actions/upload-artifact@v4
with:
name: release
path: ./package/**
retention-days: 1
- uses: ./.github/workflows/actions/checkout-orphan
name: Checkout 'release'
with:
branch: release
clean: true
- uses: actions/download-artifact@v4
with:
name: release
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
with:
initial_version: "v1.0.0"
with_initial_version: true
- name: Publish Release
run: |
function TagExists() {
git rev-parse $1 >/dev/null 2>&1
}
name=$(npm pkg get name --workspaces=false | tr -d \")
tag_version="${{ steps.get-latest-tag.outputs.tag }}"
version="${tag_version#v}"
npm pkg set version=$version
if TagExists $tag_version
then
npm version minor --no-git-tag-version
version=$(npm pkg get version --workspaces=false | tr -d \")
tag_version="v$version"
fi
git add *
git commit -m "$name@$version"
git tag $tag_version
git push origin release
git push origin $tag_version