Skip to content

Build Release

Build Release #34

Workflow file for this run

name: Build Release
on:
workflow_dispatch:
jobs:
# Build and release the Package
build:
runs-on: ubuntu-latest
permissions:
contents: write
env:
packagePath: .
steps:
# Checkout Local Repository
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.packagePath }}
submodules: recursive
# Get the Package name based on the package.json file
- name: Get Package name
id: packageName
uses: zoexx/[email protected]
with:
file_path: "${{ env.packagePath }}/package.json"
prop_path: "name"
# Get the Package version based on the package.json file
- name: Get Version
id: version
uses: zoexx/[email protected]
with:
file_path: "${{ env.packagePath }}/package.json"
prop_path: "version"
# Configure the Environment Variables needed for releasing the Package
- name: Set Environment Variables
run: |
echo "zipFile=${{ steps.packageName.outputs.value }}-${{ steps.version.outputs.value }}".zip >> $GITHUB_ENV
echo "unityPackage=${{ steps.packageName.outputs.value }}-${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV
echo "version=${{ steps.version.outputs.value }}" >> $GITHUB_ENV
# Zip the Package for release
- name: Create Package Zip
working-directory: "${{ env.packagePath }}"
run: zip -r "${{ github.workspace }}/${{ env.zipFile }}" . -x "./.git/*" "./.gitignore" "./.docfx/*"
# Build a list of .meta files for future use
- name: Track Package Meta Files
run: find "${{ env.packagePath }}/" -name \*.meta >> metaList
# Make a UnityPackage version of the Package for release
- name: Create UnityPackage
uses: pCYSl5EDgo/[email protected]
with:
package-path: ${{ env.unityPackage }}
include-files: metaList
# Make a release tag of the version from the package.json file
- name: Create Tag
id: tag_version
uses: rickstaa/[email protected]
with:
tag: "${{ env.version }}"
# Publish the Release to GitHub
- name: Make Release
uses: softprops/[email protected]
with:
files: |
${{ env.zipFile }}
${{ env.unityPackage }}
${{ env.packagePath }}/package.json
tag_name: ${{ env.version }}
prerelease: ${{ contains(env.version, '-') }}