Skip to content

Commit e9575c0

Browse files
committed
add workflow to update upm branch automatically
1 parent 03e9ae6 commit e9575c0

4 files changed

Lines changed: 108 additions & 32 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/upmsemver.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Update Unity UPM semantic versioning
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
checkSemver:
10+
name: Check for Semver Change
11+
runs-on: ubuntu-latest
12+
outputs:
13+
semver-updated: ${{ steps.check.outputs.changed }}
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v2
17+
- uses: EndBug/version-check@v1
18+
id: check
19+
with:
20+
file-name: NativeWebSocket/Assets/package.json
21+
diff-search: true
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Log when changed
24+
if: steps.check.outputs.changed == 'true'
25+
run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
26+
updateUPM:
27+
name: Update UPM branch
28+
runs-on: ubuntu-latest
29+
needs: [checkSemver]
30+
if: needs.checkSemver.outputs.semver-updated == 'true'
31+
steps:
32+
# Copy correct directory into upm branch
33+
- uses: actions/checkout@v2
34+
35+
- name: Push package directory to subtree
36+
uses: s0/git-publish-subdir-action@develop
37+
env:
38+
REPO: self
39+
BRANCH: upm
40+
FOLDER: NativeWebSocket/Assets/
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
createPackage:
43+
name: Create Unity Package and Release
44+
runs-on: ubuntu-latest
45+
needs: [checkSemver]
46+
if: needs.checkSemver.outputs.semver-updated == 'true'
47+
steps:
48+
- name: Checkout Code
49+
uses: actions/checkout@v2
50+
- name: Gather files
51+
run: |
52+
echo "NativeWebSocket/Assets/WebSocket.meta" > metaList
53+
find NativeWebSocket/Assets/WebSocket/ -name \*.meta >> metaList
54+
- name: Extract Version
55+
id: version
56+
uses: notiz-dev/github-action-json-property@release
57+
with:
58+
path: 'NativeWebSocket/Assets/package.json'
59+
prop_path: 'version'
60+
- run: echo ${{steps.version.outputs.prop}}
61+
- name: Create Directory
62+
run: mkdir Release
63+
- name: Generate Unity Package
64+
id: build-package
65+
uses: pCYSl5EDgo/create-unitypackage@master
66+
with:
67+
package-path: 'NativeWebSocket.unitypackage'
68+
include-files: metaList
69+
- name: Upload Package
70+
uses: actions/upload-artifact@master
71+
with:
72+
path: ./NativeWebSocket.unitypackage
73+
name: NativeWebSocket
74+
- name: Changelog
75+
uses: scottbrenner/generate-changelog-action@master
76+
id: Changelog
77+
- name: Create Release
78+
id: create_release
79+
uses: actions/create-release@v1
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
with:
83+
tag_name: ${{ steps.version.outputs.prop }}
84+
release_name: ${{ steps.version.outputs.prop }}
85+
body: |
86+
${{ steps.Changelog.outputs.changelog }}
87+
draft: false
88+
prerelease: true
89+
- name: Upload Release Asset
90+
id: upload-release-asset
91+
uses: actions/upload-release-asset@v1
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
with:
95+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
96+
asset_path: ./NativeWebSocket.unitypackage
97+
asset_name: NativeWebSocket.unitypackage
98+
asset_content_type: application/x-gzip

NativeWebSocket/Packages/manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"dependencies": {
3-
"com.unity.collab-proxy": "1.3.9",
4-
"com.unity.ext.nunit": "1.0.0",
5-
"com.unity.ide.rider": "1.2.1",
6-
"com.unity.ide.visualstudio": "2.0.2",
7-
"com.unity.ide.vscode": "1.2.1",
8-
"com.unity.test-framework": "1.1.16",
9-
"com.unity.textmeshpro": "3.0.1",
10-
"com.unity.timeline": "1.2.6",
3+
"com.unity.collab-proxy": "1.15.7",
4+
"com.unity.ext.nunit": "1.0.6",
5+
"com.unity.ide.rider": "3.0.9",
6+
"com.unity.ide.visualstudio": "2.0.14",
7+
"com.unity.ide.vscode": "1.2.4",
8+
"com.unity.test-framework": "1.1.29",
9+
"com.unity.textmeshpro": "3.0.6",
10+
"com.unity.timeline": "1.6.3",
1111
"com.unity.ugui": "1.0.0",
1212
"com.unity.modules.ai": "1.0.0",
1313
"com.unity.modules.androidjni": "1.0.0",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2020.1.6f1
2-
m_EditorVersionWithRevision: 2020.1.6f1 (fc477ca6df10)
1+
m_EditorVersion: 2021.2.11f1
2+
m_EditorVersionWithRevision: 2021.2.11f1 (e50cafbb4399)

0 commit comments

Comments
 (0)