-
Notifications
You must be signed in to change notification settings - Fork 3
171 lines (140 loc) · 5.42 KB
/
releasables.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Releasables
on:
push:
branches: [ main ]
pull_request:
jobs:
pack-netstandard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8'
- name: Build nupkg
run: dotnet pack src --output nupkg
- name: Archive nupkg
uses: actions/upload-artifact@v4
with:
name: nupkg
path: nupkg/*
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Library
uses: actions/cache@v4
with:
path: ResponsibleUnity/Library
key: 2019-Library-${{ hashFiles('com.beatwaves.responsible/**', 'ResponsibleUnity/**', 'src/Responsible.Tests/**') }}
restore-keys: |
2019-Library-
- name: Generate docs
uses: game-ci/unity-builder@v4
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
projectPath: ResponsibleUnity
customImage: thesbergen/unityci-docfx:2022-dotnet
targetPlatform: StandaloneLinux64
buildMethod: Responsible.EditorSetup.ContinuousIntegration.BuildDocumentation
customParameters: -disable-assembly-updater
- name: Archive docs
uses: actions/upload-artifact@v4
with:
name: Docs
path: docfx/docs_site
- name: Deploy docs
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docfx/docs_site/ResponsibleDocs
dry-run: ${{ github.ref != 'refs/heads/main' }}
version-info:
runs-on: ubuntu-latest
outputs:
old-version: ${{ steps.latest-release-version.outputs.result }}
new-version: ${{ steps.unity-version.outputs.prop }}
changelog-body: ${{ steps.changelog.outputs.changes }}
tag-name: ${{ steps.create-tag-name.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Get latest release version
id: latest-release-version
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const [owner, repo] = process.env['GITHUB_REPOSITORY'].split('/', 2);
const { data } = await github.rest.repos.getLatestRelease({ owner, repo });
return data.tag_name.substr(1);
- name: Read current Unity package version
id: unity-version
uses: notiz-dev/github-action-json-property@release
with:
path: com.beatwaves.responsible/package.json
prop_path: 'version'
- name: Read current NuGet package version
id: nuget-version
run: |
version=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' com.beatwaves.responsible/Runtime/Responsible.csproj)
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Get latest changelog entry
id: changelog
uses: mindsers/changelog-reader-action@v2
- name: Output version status
env:
CHANGELOG: ${{ steps.changelog.outputs.changes }}
run: |
echo "Previous release version: ${{ steps.latest-release-version.outputs.result }}"
echo "Current version from Unity package.json: ${{ steps.unity-version.outputs.prop }}"
echo "Current version from NuGet package: ${{ steps.nuget-version.outputs.version }}"
echo "Current version from CHANGELOG.md: ${{ steps.changelog.outputs.version }}"
echo "Changes in changelog:"
echo $CHANGELOG
- name: Check that Unity version is up to date with changelog
run: test ${{ steps.unity-version.outputs.prop }} = ${{ steps.changelog.outputs.version }}
- name: Check that NuGet version is up to date with changelog
run: test ${{ steps.nuget-version.outputs.version }} = ${{ steps.changelog.outputs.version }}
- name: Create tag name
id: create-tag-name
run: echo "tag=v${{ steps.nuget-version.outputs.version }}" >> "$GITHUB_OUTPUT"
release:
runs-on: ubuntu-latest
name: Create Release
needs: [ version-info, docs, pack-netstandard ]
if: |
github.ref == 'refs/heads/main' &&
needs.version-info.outputs.new-version != needs.version-info.outputs.old-version
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8'
- name: Download Docs
uses: actions/download-artifact@v4
with:
name: Docs
- name: Download NuGet package
uses: actions/download-artifact@v4
with:
name: nupkg
- name: Zip source code and docs
run: |
zip -r com.beatwaves.responsible.zip com.beatwaves.responsible
zip -r ResponsibleDocs.zip ResponsibleDocs
- uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
body: ${{ needs.version-info.outputs.changelog-body }}
tag_name: ${{ needs.version-info.outputs.tag-name }}
files: |
ResponsibleDocs.zip
com.beatwaves.responsible.zip
Beatwaves.Responsible.*.nupkg
- name: Publish NuGet package
run: dotnet nuget push Beatwaves.Responsible.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}