-
Notifications
You must be signed in to change notification settings - Fork 8
135 lines (125 loc) · 4.7 KB
/
test-create-release.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Test create-release
on:
workflow_dispatch:
inputs:
tag:
description: "tag: GitHub Tag to release. ex) 1.2.0"
required: true
default: ""
pull_request:
branches: ["main"]
push:
branches: ["main"]
jobs:
set-tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.set-tag.outputs.tag }}
steps:
- name: Set tag
id: set-tag
run: |
tag=${{ github.event_name == 'workflow_dispatch' && inputs.tag || format('1.2.{0}', github.run_number) }}
echo "tag=$tag" >> "$GITHUB_OUTPUT"
update-packagejson:
needs: [set-tag]
if: ${{ github.actor != 'dependabot[bot]' }}
uses: ./.github/workflows/update-packagejson.yaml
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
file-path: |
./Sandbox/Sandbox.Unity/Assets/Plugins/Foo/package.json
./Sandbox/Sandbox.Unity/Assets/Plugins/Foo.Plugin/package.json
./Sandbox/Sandbox.Godot/addons/Foo/plugin.cfg
./Sandbox/Directory.Build.props
dotnet-run-path:
./Sandbox/VersionOutput/VersionOutput.csproj
tag: ${{ needs.set-tag.outputs.tag }}
dry-run: false
push-tag: false # tagはcreate-releaseでpushするのでコミットだけさせる。
build-dotnet:
needs: [set-tag]
runs-on: ubuntu-latest
timeout-minutes: 3
defaults:
run:
working-directory: ./Sandbox
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dotnet
- name: dotnet restore
run: dotnet restore
- name: dotnet build
run: dotnet build -c Release -p:Version=${{ needs.set-tag.outputs.tag }}
- name: dotnet pack
run: dotnet pack --no-build -c Release -p:Version=${{ needs.set-tag.outputs.tag }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o ./publish
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
with:
name: nuget
path: ./Sandbox/publish
retention-days: 1
build-unity:
needs: [update-packagejson]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v4
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
# Store artifacts.
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
with:
name: Sandbox.Unity.unitypackage
path: ./Sandbox/Sandbox.Unity/output/Sandbox.Unity.unitypackage
if-no-files-found: error
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
with:
name: Sandbox.Unity.Plugin.unitypackage
path: ./Sandbox/Sandbox.Unity/output/Sandbox.Unity.Plugin.unitypackage
if-no-files-found: error
# full release
create-release:
needs: [set-tag, update-packagejson, build-dotnet, build-unity]
uses: ./.github/workflows/create-release.yaml
with:
commit-id: ${{ needs.update-packagejson.outputs.sha }}
tag: ${{ needs.set-tag.outputs.tag }}
dry-run: true # true = Release作成後に60秒待って削除される。
nuget-push: true # dry-run=true, nuget-push=true なら nuget-pushは実行されない。
release-upload: true
release-asset-path: |
./nuget/*.nupkg
./nuget/*.snupkg
./Sandbox.Unity.unitypackage/Sandbox.Unity.unitypackage
./Sandbox.Unity.Plugin.unitypackage/Sandbox.Unity.Plugin.unitypackage
secrets: inherit
# change release format
create-release2:
needs: [set-tag, update-packagejson, create-release]
uses: ./.github/workflows/create-release.yaml
with:
commit-id: ${{ needs.update-packagejson.outputs.sha }}
tag: ${{ needs.set-tag.outputs.tag }}
dry-run: true # true = Release作成後に60秒待って削除される。
release-format: '{0}'
secrets: inherit
# v prefixed version
create-release3:
needs: [set-tag, update-packagejson, create-release2]
uses: ./.github/workflows/create-release.yaml
with:
commit-id: ${{ needs.update-packagejson.outputs.sha }}
tag: v${{ needs.set-tag.outputs.tag }}
dry-run: true # true = Release作成後に60秒待って削除される。
secrets: inherit
cleanup:
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
needs: [update-packagejson]
uses: ./.github/workflows/clean-packagejson-branch.yaml
with:
branch: ${{ needs.update-packagejson.outputs.branch-name }}
actions-timeline:
needs: [set-tag, update-packagejson, build-dotnet, build-unity, create-release, create-release2, create-release3]
uses: ./.github/workflows/actions-timeline.yaml
secrets: inherit