This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
Build Bleeding Edge #9
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 Bleeding Edge | |
on: | |
workflow_dispatch: | |
push: | |
branches: main | |
paths: package.json | |
env: | |
packageName: "dev.runaxr.redline" | |
packagePath: "Packages/dev.runaxr.redline" | |
packageFileName: "Redline" | |
packageReleaseName: "Bleeding Edge" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Version | |
id: version | |
uses: zoexx/github-action-json-file-properties@b9f36ce6ee6fe2680cd3c32b2c62e22eade7e590 | |
with: | |
file_path: "./package.json" | |
prop_path: "version" | |
- name: Generate Tag | |
id: tag | |
run: echo prop="v${{ steps.version.outputs.value }}" >> $GITHUB_OUTPUT | |
- name: Check If Release Tag Exists | |
id: checkReleaseTag | |
uses: mukunku/[email protected] | |
with: | |
tag: ${{ steps.tag.outputs.prop }} | |
- name: Set Environment Variables | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
run: | | |
echo "zipFile=${{ env.packageFileName }}_v${{ steps.version.outputs.value }}_VPM".zip >> $GITHUB_ENV | |
echo "unityPackage=${{ env.packageFileName }}_v${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV | |
- name: Set ZIP Url | |
uses: jossef/[email protected] | |
with: | |
file: ./package.json | |
field: url | |
value: 'https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.prop }}/${{ env.zipFile }}' | |
- name: Set UnityPackage Url | |
uses: jossef/[email protected] | |
with: | |
file: ./package.json | |
field: unityPackage | |
value: 'https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.prop }}/${{ env.unityPackage }}' | |
- name: Create directory and move files | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
run: | | |
mkdir -p ${{env.packagePath}} | |
rsync -r --exclude="${{ env.packagePath }}" ./ "${{ env.packagePath }}"/ | |
- name: Create Zip | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 | |
with: | |
type: "zip" | |
directory: "${{env.packagePath}}/" | |
filename: "../../${{env.zipFile}}" # make the zip file two directories up, since we start two directories in above | |
exclusions: "*.git* *.github* .gitignore Packages/" | |
- run: find "${{env.packagePath}}" -name \*.meta >> metaList | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
- name: Create UnityPackage | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b | |
with: | |
package-path: ${{ env.unityPackage }} | |
include-files: metaList | |
- name: Add Icon to UnityPackage | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: foxscore/add-icon-to-unitypackage@v1 | |
with: | |
package_path: ${{ env.unityPackage }} | |
icon_path: '.github/thumbnail.png' | |
package_not_found_behavior: 'warn' | |
icon_not_found_behavior: 'warn' | |
icon_already_present_behavior: 'warn' | |
- name: Make Release | |
if: ${{ steps.checkReleaseTag.outputs.exists == 'false' }} | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
name: "${{ env.packageReleaseName }} v${{ steps.version.outputs.value }}" | |
tag_name: "v${{ steps.version.outputs.value }}" | |
files: | | |
${{ env.zipFile }} | |
${{ env.unityPackage }} | |
./package.json |