@@ -2,7 +2,9 @@ name: Build Release
22
33on :
44 workflow_dispatch :
5-
5+ permissions :
6+ actions : write
7+ contents : write
68jobs :
79 config :
810 outputs :
@@ -18,37 +20,23 @@ jobs:
1820 echo "configPackage=false" >> $GITHUB_OUTPUT;
1921 fi
2022
21- build :
22- env :
23- packagePath : Packages/${{ vars.PACKAGE_NAME }}
24- stableVersion : ' '
25- unityPackage : ' '
26- version : ' '
27- zipFile : ' '
23+ prepare :
2824 if : needs.config.outputs.config_package == 'true'
2925 needs : config
30- permissions :
31- contents : write
26+ outputs :
27+ stableVersion : ${{ steps.resolve.outputs.stableVersion }}
28+ unityPackage : ${{ steps.resolve.outputs.unityPackage }}
29+ version : ${{ steps.resolve.outputs.version }}
30+ zipFile : ${{ steps.resolve.outputs.zipFile }}
3231 runs-on : ubuntu-latest
3332 steps :
34- - id : gpg
35- name : Import the GPG key
36- # cspell: disable-next-line
37- uses : crazy-max/ghaction-import-gpg@v6
38- with :
39- gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
40- passphrase : ${{ secrets.GPG_PASSPHRASE }}
41- trust_level : 5
42- - name : Checkout Local Repository
43- uses : actions/checkout@v4
44- - name : copy the README and LICENSE files to the Package folder
45- run : cp README.md LICENSE "${{ env.packagePath }}"
33+ - uses : actions/checkout@v4
4634 - id : version
4735 name : Get the Package version based on the package.json file
4836 # cspell: disable-next-line
4937 uses : sergeysova/jq-action@v2
5038 with :
51- cmd : jq -r ".version" "${{ env.packagePath }}/package.json"
39+ cmd : jq -r ".version" "Packages/ ${{ vars.PACKAGE_NAME }}/package.json"
5240 - id : stable-match
5341 name : Detect whether the version is a stable release
5442 # cspell: disable-next-line
@@ -57,31 +45,66 @@ jobs:
5745 flags : gm
5846 regex : ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
5947 text : ${{ steps.version.outputs.value }}
60- - name : Configure the Environment Variables needed for releasing the Package
48+ - id : resolve
49+ name : Resolve build environment values
6150 run : |
62- echo "stableVersion=${{ steps.stable-match.outputs.match }}" >> $GITHUB_ENV
63- echo "unityPackage=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV
64- echo "version=${{ steps.version.outputs.value }}" >> $GITHUB_ENV
65- echo "zipFile=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.zip" >> $GITHUB_ENV
66- - name : Zip the Package for release
67- run : zip -r -9 "${{ github.workspace }}/${{ env.zipFile }}" .
68- working-directory : " ${{ env.packagePath }}"
69- - name : Build a list of .meta files for future use
70- run : find "${{ env.packagePath }}/" -name '*.meta' -type f >> metaList
71- - name : Make a UnityPackage version of the Package for release
72- uses : pCYSl5EDgo/create-unitypackage@v1
51+ echo "stableVersion=${{ steps.stable-match.outputs.match }}" >> $GITHUB_OUTPUT
52+ echo "unityPackage=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_OUTPUT
53+ echo "version=${{ steps.version.outputs.value }}" >> $GITHUB_OUTPUT
54+ echo "zipFile=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.zip" >> $GITHUB_OUTPUT
55+
56+ package :
57+ if : needs.config.outputs.config_package == 'true'
58+ needs :
59+ - config
60+ - prepare
61+ uses : ./.github/workflows/package-build.yml
62+ with :
63+ packagePath : Packages/${{ vars.PACKAGE_NAME }}
64+ unityPackage : ${{ needs.prepare.outputs.unityPackage }}
65+ zipFile : ${{ needs.prepare.outputs.zipFile }}
66+
67+ build :
68+ env :
69+ packagePath : Packages/${{ vars.PACKAGE_NAME }}
70+ stableVersion : ${{ needs.prepare.outputs.stableVersion }}
71+ unityPackage : ${{ needs.prepare.outputs.unityPackage }}
72+ version : ${{ needs.prepare.outputs.version }}
73+ zipFile : ${{ needs.prepare.outputs.zipFile }}
74+ if : needs.config.outputs.config_package == 'true'
75+ needs :
76+ - config
77+ - prepare
78+ - package
79+ runs-on : ubuntu-latest
80+ steps :
81+ - id : gpg
82+ name : Import the GPG key
83+ # cspell: disable-next-line
84+ uses : crazy-max/ghaction-import-gpg@v6
85+ with :
86+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
87+ passphrase : ${{ secrets.GPG_PASSPHRASE }}
88+ trust_level : 5
89+ - name : Checkout Local Repository
90+ uses : actions/checkout@v4
91+ - name : Download package archive
92+ uses : actions/download-artifact@v4
93+ with :
94+ name : ${{ env.zipFile }}
95+ - name : Download UnityPackage
96+ uses : actions/download-artifact@v4
7397 with :
74- include-files : metaList
75- package-path : ${{ env.unityPackage }}
98+ name : ${{ env.unityPackage }}
99+ - name : copy the README and LICENSE files to the Package folder
100+ run : cp README.md LICENSE "${{ env.packagePath }}"
76101 - name : Zip the UnityPackage for release
77102 run : zip -r -9 "${{ env.unityPackage }}.zip" "${{ env.unityPackage }}" LICENSE README.md
78- - env :
79- GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
80- name : Sign the artifacts
103+ - name : Sign the artifacts
81104 run : |
82- echo "${GPG_PASSPHRASE}" | gpg --batch -ab "${{ env.zipFile }}"
83- echo "${GPG_PASSPHRASE}" | gpg --batch -ab "${{ env.unityPackage }}"
84- echo "${GPG_PASSPHRASE}" | gpg --batch -ab "${{ env.unityPackage }}.zip"
105+ gpg --batch --pinentry-mode loopback --passphrase "${{ secrets. GPG_PASSPHRASE }}" -ab "${{ env.zipFile }}"
106+ gpg --batch --pinentry-mode loopback --passphrase "${{ secrets. GPG_PASSPHRASE }}" -ab "${{ env.unityPackage }}"
107+ gpg --batch --pinentry-mode loopback --passphrase "${{ secrets. GPG_PASSPHRASE }}" -ab "${{ env.unityPackage }}.zip"
85108 - id : tag_version
86109 name : Create a release tag of the version from the package.json file
87110 # cspell: disable-next-line
0 commit comments