modular-avatar/.github/workflows/build-release.yml

81 lines
2.6 KiB
YAML
Raw Normal View History

2022-09-08 11:46:13 +08:00
name: Build Release
2022-08-29 11:16:02 +08:00
2022-09-08 11:46:13 +08:00
on:
workflow_dispatch:
2022-09-09 11:52:06 +08:00
pull_request:
2022-09-08 11:46:13 +08:00
push:
2022-09-09 11:37:40 +08:00
branches:
- main
tags:
- '**'
2022-09-08 11:46:13 +08:00
env:
packageName: "net.fushizen.modular-avatar"
2022-08-29 11:16:02 +08:00
jobs:
2022-09-08 11:46:13 +08:00
build:
2022-08-29 11:16:02 +08:00
runs-on: ubuntu-latest
steps:
2022-09-08 11:46:13 +08:00
- name: Checkout
uses: actions/checkout@v3
2022-10-23 04:31:10 +08:00
- name: Checkout logo assets
uses: actions/checkout@v3
if: startsWith(github.ref, 'refs/tags/')
with:
repository: bdunderscore/modular-avatar-images
path: image-assets
- name: Inject logo assets
if: startsWith(github.ref, 'refs/tags/')
run: |
cp -f image-assets/img/logo/ma_logo.png Packages/net.fushizen.modular-avatar/Editor/Images/logo.png
2022-09-08 11:46:13 +08:00
- name: get version
2022-08-29 11:16:02 +08:00
id: version
2022-09-08 11:46:13 +08:00
uses: notiz-dev/github-action-json-property@7c8cf5cc36eb85d8d287a8086a39dac59628eb31
2022-08-29 11:16:02 +08:00
with:
2022-09-08 11:46:13 +08:00
path: "Packages/${{env.packageName}}/package.json"
prop_path: "version"
2022-09-09 11:37:40 +08:00
- name: Check tag consistency
if: startsWith(github.ref, 'refs/tags/')
run: |
if [ "${{ steps.version.outputs.prop }}" != "${GITHUB_REF##*/}" ]; then
echo "Version in package.json does not match tag name: ${{ steps.version.outputs.prop }} != ${GITHUB_REF##*/}"
exit 1
fi
2022-09-08 11:46:13 +08:00
- run: echo ${{steps.version.outputs.prop}}
- name: Set Environment Variables
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
uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657
2022-08-29 11:16:02 +08:00
with:
2022-09-08 11:46:13 +08:00
type: "zip"
directory: "Packages/${{env.packageName}}/"
filename: "../../${{env.zipFile}}" # make the zip file two directories up, since we start two directories in above
- run: find "Packages/${{env.packageName}}/" -name \*.meta >> metaList
- name: Create UnityPackage
uses: pCYSl5EDgo/create-unitypackage@e28c7a4616b2754c564b0a959a03b3c89b756fdb
2022-08-29 11:16:02 +08:00
with:
2022-09-08 11:46:13 +08:00
package-path: ${{ env.unityPackage }}
include-files: metaList
- name: Make Release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
2022-09-09 11:37:40 +08:00
if: startsWith(github.ref, 'refs/tags/')
2022-08-29 11:16:02 +08:00
with:
2022-09-09 11:37:40 +08:00
draft: true
generate_release_notes: true
2022-09-08 11:46:13 +08:00
tag_name: ${{ steps.version.outputs.prop }}
files: |
${{ env.zipFile }}
${{ env.unityPackage }}
Packages/${{ env.packageName }}/package.json