-
Notifications
You must be signed in to change notification settings - Fork 115
117 lines (110 loc) · 4.02 KB
/
Copy pathupmsemver.yml
File metadata and controls
117 lines (110 loc) · 4.02 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
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
name: Update Unity UPM semantic versioning
on:
push:
branches:
- master
- dev
# A release that fails after the version was bumped cannot be retried by
# pushing again — the semver check only fires on the commit that changed it.
workflow_dispatch:
jobs:
checkSemver:
name: Check for Semver Change
runs-on: ubuntu-latest
if: github.event_name == 'push'
outputs:
semver-updated: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- uses: EndBug/version-check@v2
id: check
with:
file-name: Assets/Colyseus/package.json
diff-search: true
checkMeta:
name: Check Unity .meta files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# A file without a committed .meta silently drops out of both the upm
# branch and the .unitypackage — never publish one. See issue #270.
- run: ./scripts/check-meta.sh
updateUPM:
name: Update UPM branch
runs-on: ubuntu-latest
needs: [checkSemver, checkMeta]
if: ${{ !cancelled() && needs.checkMeta.result == 'success' && (needs.checkSemver.outputs.semver-updated == 'true' || github.event_name == 'workflow_dispatch') }}
steps:
- uses: actions/checkout@v2
- name: Fetch NativeWebSocket
run: bash unity-setup.sh
- name: Remove test symlink
run: rm -rf Assets/Colyseus/Tests
- name: Push package directory to subtree
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: upm
FOLDER: Assets/Colyseus/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
createPackage:
name: Create Unity Package and Release
runs-on: ubuntu-latest
needs: [checkSemver, checkMeta]
if: ${{ !cancelled() && needs.checkMeta.result == 'success' && (needs.checkSemver.outputs.semver-updated == 'true' || github.event_name == 'workflow_dispatch') }}
permissions:
contents: write # create the release and upload its asset
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Fetch NativeWebSocket
run: bash unity-setup.sh
- name: Remove test symlink
run: rm -rf Assets/Colyseus/Tests
- name: Gather files
run: |
echo "Assets/Colyseus.meta" > metaList
find Assets/Colyseus/ -name \*.meta >> metaList
- name: Extract Version
id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'Assets/Colyseus/package.json'
prop_path: 'version'
- run: echo ${{steps.version.outputs.prop}}
- name: Create Directory
run: mkdir Release
- name: Generate Unity Package
id: build-package
uses: pCYSl5EDgo/create-unitypackage@v1.2.3
with:
package-path: 'Colyseus_Plugin.unitypackage'
include-files: metaList
- name: Upload Package
uses: actions/upload-artifact@master
with:
path: ./Colyseus_Plugin.unitypackage
name: Colyseus_Plugin
# The release notes ARE the changelog section for this version. Missing section = failed
# release, never a silently empty one: an empty body is what shipped for 0.17.17..0.17.20,
# back when the notes were generated from commit messages.
- name: Extract release notes
run: |
awk -v version="${{ steps.version.outputs.prop }}" '
$0 == "## " version { found = 1; next }
found && /^## / { exit }
found { print }
' Assets/Colyseus/CHANGELOG.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "::error file=Assets/Colyseus/CHANGELOG.md::No '## ${{ steps.version.outputs.prop }}' section — add one before bumping the version."
exit 1
fi
cat RELEASE_NOTES.md
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.prop }}
name: ${{ steps.version.outputs.prop }}
body_path: RELEASE_NOTES.md
files: ./Colyseus_Plugin.unitypackage