-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (46 loc) · 1.88 KB
/
PublishUnity3dPackage.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
name: Publish Unity3d Package
on:
workflow_call:
env:
version_file: ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj
jobs:
PublishUnity3dPackage:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- id: get-version
run: |
version=$(grep -oP '(?<=<Version>)[^<]+' "${{ env.version_file }}")
echo "version=$version" >> $GITHUB_OUTPUT
- name: Check if release exists
id: release-exists
env:
GH_TOKEN: ${{ github.token }}
run: |
release_exists=$(gh release view "v${{ steps.get-version.outputs.version }}" &> /dev/null && echo "true" || echo "false")
echo "Release exists $release_exists"
echo "exists=$release_exists" >> $GITHUB_OUTPUT
- name: Create Package
if: ${{ steps.release-exists.outputs.exists == 'false' }}
run: |
sh ./ManualDi.Unity3d/GenerateUnityPackage/GeneratePackage.sh
- name: Create github release
if: ${{ steps.release-exists.outputs.exists == 'false' }}
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get-version.outputs.version }}
name: ManualDi Unity3d v${{ steps.get-version.outputs.version }}
files: |
UnityPackageRelease/com.pereviader.manualdi.unity3d-${{ steps.get-version.outputs.version }}.tgz
- name: Trigger Unity3d Repo Workflow
if: ${{ steps.release-exists.outputs.exists == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_UNITY3D }}
run: |
gh workflow run PublishUnity3dPackage.yml \
--repo PereViader/ManualDi.Unity3d \
--ref main \
-f release-tag=v${{ steps.get-version.outputs.version }} \
-f file-name=com.pereviader.manualdi.unity3d-${{ steps.get-version.outputs.version }}.tgz