Skip to content

Commit 6562a71

Browse files
committed
Update workflow and package version
1 parent dc35164 commit 6562a71

2 files changed

Lines changed: 28 additions & 51 deletions

File tree

.github/workflows/PublicPackage.yml

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,56 @@ name: Publish UPM Package
22

33
on:
44
push:
5-
tags:
6-
- "v*.*.*"
5+
branches:
6+
- main
7+
paths:
8+
- 'package.json' # Only runs when this file is changed
79

810
jobs:
9-
update-and-release:
11+
release-on-version-change:
1012
runs-on: ubuntu-latest
1113
permissions:
12-
contents: write
14+
contents: write
1315

1416
steps:
1517
- name: Check out code
1618
uses: actions/checkout@v4
17-
with:
18-
fetch-depth: 0
19-
20-
- name: Prepare and Update Version
21-
id: prep
22-
run: |
23-
# Strip 'v' for Unity (v1.0.6 -> 1.0.6)
24-
RAW_TAG=${{ github.ref_name }}
25-
CLEAN_TAG=$(echo $RAW_TAG | sed 's/^v//')
26-
echo "tag=$CLEAN_TAG" >> $GITHUB_OUTPUT
27-
28-
if [ -f package.json ]; then
29-
# Update the version string in package.json
30-
sed -i "s/\"version\": \".*\"/\"version\": \"$CLEAN_TAG\"/" package.json
31-
else
32-
echo "package.json not found!" && exit 1
33-
fi
34-
shell: bash
3519

36-
- name: Commit and Push to Main
20+
- name: Extract Version from package.json
21+
id: get_version
3722
run: |
38-
git config user.name "github-actions[bot]"
39-
git config user.email "github-actions[bot]@users.noreply.github.com"
40-
41-
# 1. Fetch the latest and move to main
42-
git fetch origin main
43-
git checkout main
44-
45-
# 2. Update the file (it was modified on the detached HEAD, so we move it here)
46-
git checkout ${{ github.sha }} package.json
47-
48-
# 3. Commit and Push
49-
git add package.json
50-
git commit -m "chore: bump version to ${{ steps.prep.outputs.tag }}" || echo "No changes to commit"
51-
52-
# 4. Use --force-with-lease to safely overwrite the remote version bump
53-
git push origin main
23+
# Pulls the version string from package.json
24+
VERSION=$(grep '"version":' package.json | cut -d'"' -f4)
25+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
26+
echo "Detected Version: $VERSION"
5427
shell: bash
5528

56-
- name: Create .tgz Artifact
29+
- name: Create UPM Package (tarball)
5730
run: |
58-
PACKAGE_NAME="com.cjhawk.graphnodeeditor-${{ steps.prep.outputs.tag }}.tgz"
59-
# The fix: Exclude any .tgz files so tar doesn't try to include its own output
60-
tar -czf "$PACKAGE_NAME" --exclude='.git*' --exclude='*.tgz' .
31+
# Use npm pack to create a clean Unity-compatible tarball
32+
# Alternatively, use tar if you aren't using a full npm environment
33+
PACKAGE_NAME="com.cjhawk.graphnodeeditor-${{ steps.get_version.outputs.VERSION }}.tgz"
34+
tar -czf "$PACKAGE_NAME" --exclude='.git*' --exclude='.github*' --exclude='*.tgz' .
6135
echo "PACKAGE_PATH=$PACKAGE_NAME" >> $GITHUB_ENV
6236
6337
- name: Create GitHub Release
6438
uses: softprops/action-gh-release@v2
6539
with:
66-
tag_name: ${{ github.ref_name }}
67-
name: "Release ${{ github.ref_name }}"
40+
# Uses the version from package.json as the tag name (e.g., 1.0.8)
41+
tag_name: v${{ steps.get_version.outputs.VERSION }}
42+
name: "Release ${{ steps.get_version.outputs.VERSION }}"
6843
body: |
69-
## Node Graph Editor ${{ steps.prep.outputs.tag }}
44+
## Node Graph Editor ${{ steps.get_version.outputs.VERSION }}
7045
71-
The `package.json` version has been synced to `${{ steps.prep.outputs.tag }}`.
46+
This release was automatically generated based on updates to `package.json`.
7247
7348
### Installation
74-
- **Git URL:** `https://github.com/Selva1910/NodeGraphEditor.git#${{ github.ref_name }}`
75-
- **Tarball:** Use "Add package from tarball" in Unity and select the `.tgz` below.
49+
- **Git URL:** `https://github.com/Selva1910/NodeGraphEditor.git#v${{ steps.get_version.outputs.VERSION }}`
50+
- **Tarball:** Download the `.tgz` below and use "Add package from tarball" in Unity.
7651
7752
---
7853
*Author: Selvaraj Balakrishnan*
7954
*License: AGPLv3 (Attribution Required)*
80-
files: ${{ env.PACKAGE_PATH }}
55+
files: ${{ env.PACKAGE_PATH }}
56+
draft: false
57+
prerelease: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.cjhawk.graphnodeeditor",
33
"version": "1.0.8",
4-
"displayName": "Node Graph Editor",
4+
"displayName": "Node Graph Editor ",
55
"description": "A visual node graph editor for Unity, built from scratch using the GraphView API — designed to power event-driven, flow-based gameplay logic through a ScriptableObject architecture.",
66
"unity": "2022.3",
77
"unityRelease": "21f1",

0 commit comments

Comments
 (0)