Skip to content

Build Release

Build Release #19

Workflow file for this run

name: Build Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'Packages/*/package.json'
env:
LISTING_REPOSITORY: yukineko-works/vpm.yukineko.dev
PACKAGE_PATH: Packages/${{ vars.PACKAGE_NAME }}
jobs:
check:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.variables.outputs.valid == 'true' && steps.tag.outputs.exists == 'false' }}
version: ${{ steps.package.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate Variables
id: variables
run: |
if [ "${{ vars.PACKAGE_NAME }}" != "" ]; then
echo "valid=true" >> $GITHUB_OUTPUT;
else
echo "valid=false" >> $GITHUB_OUTPUT;
fi
- name: Load Package
if: steps.variables.outputs.valid == 'true'
id: package
uses: zoexx/github-action-json-file-properties@b9f36ce6ee6fe2680cd3c32b2c62e22eade7e590
with:
file_path: "${{ env.PACKAGE_PATH }}/package.json"
- name: Tag Exist Check
if: steps.variables.outputs.valid == 'true'
id: tag
uses: action-pack/tag-exists@v1
with:
tag: ${{ steps.package.outputs.version }}
build:
needs: check
runs-on: ubuntu-latest
if: needs.check.outputs.build == 'true'
permissions:
contents: write
env:
ZIP_FILE: ${{ vars.PACKAGE_NAME }}-${{ needs.check.outputs.version }}.zip
UNITY_PACKAGE: ${{ vars.PACKAGE_NAME }}-${{ needs.check.outputs.version }}.unitypackage
VERSION: ${{ needs.check.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Package Zip
working-directory: "${{ env.PACKAGE_PATH }}"
run: zip -r "${{ github.workspace }}/${{ env.ZIP_FILE }}" .
- name: Track Package Meta Files
run: find "${{ env.PACKAGE_PATH }}/" -name \*.meta >> metaList
- name: Create UnityPackage
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b
with:
package-path: ${{ env.UNITY_PACKAGE }}
include-files: metaList
- name: Make Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
files: |
${{ env.ZIP_FILE }}
${{ env.UNITY_PACKAGE }}
${{ env.PACKAGE_PATH }}/package.json
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.VPM_DISPATCH_TOKEN }}
repository: ${{ env.LISTING_REPOSITORY }}
event-type: deploy