-
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.61 KB
/
Copy pathrelease.yml
File metadata and controls
76 lines (63 loc) · 2.61 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
name: Build Release
on:
workflow_dispatch:
push:
branches: main
paths: Packages/net.pawlygon.unitytools/package.json
env:
packageName: "net.pawlygon.unitytools"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: get version
id: version
uses: notiz-dev/github-action-json-property@7c8cf5cc36eb85d8d287a8086a39dac59628eb31
with:
path: "Packages/${{env.packageName}}/package.json"
prop_path: "version"
# package.json also changes for descriptions or URLs. Only build a release for a version that
# has no tag yet, so an existing release is never rebuilt or overwritten.
- name: Check for existing release
id: existing
run: |
if git ls-remote --exit-code --tags origin "refs/tags/${{ steps.version.outputs.prop }}" > /dev/null; then
echo "Release ${{ steps.version.outputs.prop }} already exists, skipping."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Set Environment Variables
if: steps.existing.outputs.exists == 'false'
run: |
echo "zipFile=${{ env.packageName }}-${{ steps.version.outputs.prop }}".zip >> $GITHUB_ENV
echo "unityPackage=${{ env.packageName }}-${{ steps.version.outputs.prop }}.unitypackage" >> $GITHUB_ENV
- name: Create Zip
if: steps.existing.outputs.exists == 'false'
uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657
with:
type: "zip"
directory: "Packages/${{env.packageName}}/"
filename: "../../${{env.zipFile}}" # make the zip file two directories up, since we start two directories in above
- name: List meta files
if: steps.existing.outputs.exists == 'false'
run: find "Packages/${{env.packageName}}/" -name \*.meta >> metaList
- name: Create UnityPackage
if: steps.existing.outputs.exists == 'false'
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b
with:
package-path: ${{ env.unityPackage }}
include-files: metaList
- name: Make Release
if: steps.existing.outputs.exists == 'false'
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
tag_name: ${{ steps.version.outputs.prop }}
files: |
${{ env.zipFile }}
${{ env.unityPackage }}
Packages/${{ env.packageName }}/package.json