-
Notifications
You must be signed in to change notification settings - Fork 8
115 lines (101 loc) · 4.14 KB
/
Copy pathrelease.yml
File metadata and controls
115 lines (101 loc) · 4.14 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
name: Release
on:
push:
branches: [master]
workflow_dispatch:
jobs:
build-package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Semantic release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Recreate the UPM (Release) branch for the latest version
- name: Create UPM Branch
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Checking out UPM Branch
git checkout master
git config --global user.name oc-bot
git config --global user.email opencommissioning@spiratec.com
git checkout -B upm
# Prep for release, hide Samples/ from Unity's compiler
- name: Refactor/Hide Samples Folder
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Refactoring Samples
if [[ -d "Samples" ]]; then
git mv Samples Samples~
rm -f Samples.meta
fi
# Prep for release, hide Documentation/ from Unity's compiler
- name: Refactor/Hide Documentation Folder
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Refactoring Documentation
if [[ -d "Documentation" ]]; then
git mv Documentation Documentation~
rm -f Documentation.meta
fi
# Prep for release, hide Tests/ from Unity's compiler
- name: Refactor/Hide Tests Folder
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Refactoring Documentation
if [[ -d "Tests" ]]; then
git mv Tests Tests~
rm -f Tests.meta
fi
# RIf there's a new version, remove unwanted files from the upm branch
- name: Remove CI Files
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Removing Continuous Integration Files
rm -f ".releaserc.json"
rm -rf ".github"
rm -f ".gitignore"
# Push the UPM branch with this release
- name: Push UPM Branch
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Pushing Release to UPM Branch
git commit -am "Release v${{steps.semantic.outputs.new_release_version}}"
git push -f -u origin upm
# Tag the UPM branch with this release
- name: Tag UPM Branch
if: steps.semantic.outputs.new_release_published == 'true'
run: |
git tag -f upm/v${{ steps.semantic.outputs.new_release_version }} upm
git push -f origin --tags
# Create package tarball for release artifact
- name: Create Package Tarball
if: steps.semantic.outputs.new_release_published == 'true'
run: |
mkdir package && find . -maxdepth 1 ! -name "package" ! -name "." -exec mv {} package/ \; && tar -czf OC-Core-${{steps.semantic.outputs.new_release_version}}.tar.gz package/ && shopt -s dotglob && mv package/* ./ && rmdir package
# Publish this tagged as a release
- name: Publish New Repo Release
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Creating Repo Release
gh release create upm/v${{steps.semantic.outputs.new_release_version}} -t "Release ${{steps.semantic.outputs.new_release_version}}" -n "${{steps.semantic.outputs.new_release_notes}}"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Upload package Tarball
- name: Upload Release Artifact
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Uploading release asset
gh release upload upm/v${{ steps.semantic.outputs.new_release_version }} OC-Core-${{ steps.semantic.outputs.new_release_version }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}