Update #11
This file contains hidden or 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: Publish UPM Package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'package.json' # Only runs when this file is changed | |
| jobs: | |
| release-on-version-change: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Extract Version from package.json | |
| id: get_version | |
| run: | | |
| # Pulls the version string from package.json | |
| VERSION=$(grep '"version":' package.json | cut -d'"' -f4) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Detected Version: $VERSION" | |
| shell: bash | |
| - name: Create UPM Package (tarball) | |
| run: | | |
| # 1. Define names | |
| VERSION=${{ steps.get_version.outputs.VERSION }} | |
| PACKAGE_NAME="com.cjhawk.graphnodeeditor-${VERSION}.tgz" | |
| # 2. Run tar, but output to /tmp to avoid the "file changed" error | |
| tar -czf "/tmp/$PACKAGE_NAME" \ | |
| --exclude='.git*' \ | |
| --exclude='.github*' \ | |
| --exclude='*.tgz' \ | |
| . | |
| # 3. Move it back to the workspace for the release step | |
| mv "/tmp/$PACKAGE_NAME" . | |
| echo "PACKAGE_PATH=$PACKAGE_NAME" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| # Uses the version from package.json as the tag name (e.g., 1.0.8) | |
| tag_name: v${{ steps.get_version.outputs.VERSION }} | |
| name: "Release ${{ steps.get_version.outputs.VERSION }}" | |
| body: | | |
| ## Node Graph Editor ${{ steps.get_version.outputs.VERSION }} | |
| This release was automatically generated based on updates to `package.json`. | |
| ### Installation | |
| - **Git URL:** `https://github.com/Selva1910/NodeGraphEditor.git#v${{ steps.get_version.outputs.VERSION }}` | |
| - **Tarball:** Download the `.tgz` below and use "Add package from tarball" in Unity. | |
| --- | |
| *Author: Selvaraj Balakrishnan* | |
| *License: AGPLv3 (Attribution Required)* | |
| files: ${{ env.PACKAGE_PATH }} | |
| draft: false | |
| prerelease: false |