Build Release #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Release | |
on: | |
workflow_dispatch: | |
jobs: | |
config: | |
runs-on: ubuntu-latest | |
outputs: | |
config_package: ${{ steps.config_package.outputs.configPackage }} | |
steps: | |
# Ensure that required repository variable has been created for the Package | |
- name: Validate Package Config | |
id: config_package | |
run: | | |
if [ "${{ vars.PACKAGE_NAME }}" != "" ]; then | |
echo "configPackage=true" >> $GITHUB_OUTPUT; | |
else | |
echo "configPackage=false" >> $GITHUB_OUTPUT; | |
fi | |
# Build and release the Package | |
# If the repository is not configured properly, this job will be skipped | |
build: | |
needs: config | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
packagePath: Packages/${{ vars.PACKAGE_NAME }} | |
if: needs.config.outputs.config_package == 'true' | |
steps: | |
- name: Checkout Local Repository | |
uses: actions/checkout@v4 | |
- name: Get the Package version based on the package.json file | |
id: version | |
uses: zoexx/github-action-json-file-properties@b9f36ce6ee6fe2680cd3c32b2c62e22eade7e590 | |
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=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}".zip >> $GITHUB_ENV | |
echo "unityPackage=${{ vars.PACKAGE_NAME }}-${{ 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 }}" . | |
# 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/create-unitypackage@v1 | |
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/action-create-tag@v1 | |
with: | |
tag: "${{ env.version }}" | |
# Publish the Release to GitHub | |
- name: Make Release | |
uses: softprops/action-gh-release@v0.1.15 | |
with: | |
files: | | |
${{ env.zipFile }} | |
${{ env.unityPackage }} | |
${{ env.packagePath }}/package.json | |
tag_name: ${{ env.version }} |