11name : Release on Tag
2-
32on :
43 push :
54 tags :
65 - ' *' # match any tag
7-
86permissions :
97 contents : write
10-
118jobs :
129 release :
1310 runs-on : ubuntu-latest
14-
1511 steps :
1612 - name : Checkout repository
1713 uses : actions/checkout@v4
1814 with :
1915 fetch-depth : 0
20-
2116 - name : Extract tag version
2217 id : tag
2318 run : |
2419 TAG_NAME="${GITHUB_REF#refs/tags/}"
2520 TAG_VERSION="$TAG_NAME"
26-
2721 echo "Tag name: $TAG_NAME"
2822 echo "Tag version: $TAG_VERSION"
29-
3023 echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
3124 echo "tag_version=$TAG_VERSION" >> "$GITHUB_OUTPUT"
32-
3325 - name : Read package.json version
3426 id : pkg
3527 run : |
3628 PKG_VERSION=$(jq -r '.version' package.json)
37-
3829 if [ -z "$PKG_VERSION" ] || [ "$PKG_VERSION" = "null" ]; then
3930 echo "::error::Could not read version from package.json"
4031 exit 1
4132 fi
42-
4333 echo "package.json version: $PKG_VERSION"
4434 echo "pkg_version=$PKG_VERSION" >> "$GITHUB_OUTPUT"
45-
4635 - name : Verify tag matches package.json version
4736 run : |
4837 if [ "${{ steps.tag.outputs.tag_version }}" != "${{ steps.pkg.outputs.pkg_version }}" ]; then
5140 echo "package.json: ${{ steps.pkg.outputs.pkg_version }}"
5241 exit 1
5342 fi
54-
5543 - name : Ensure release does not already exist
5644 env :
5745 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -60,25 +48,14 @@ jobs:
6048 echo "::error::Release already exists for this tag"
6149 exit 1
6250 fi
63-
6451 - name : Create VPM package zip
6552 run : |
6653 PKG_NAME=$(jq -r '.name' package.json)
6754 VERSION=$(jq -r '.version' package.json)
68-
6955 ZIP_NAME="${PKG_NAME}-${VERSION}.zip"
70-
7156 echo "Creating $ZIP_NAME"
72-
73- zip -r "$ZIP_NAME" \
74- package.json \
75- Runtime/ \
76- Editor/ \
77- Resources/
78- -x "*.meta"
79-
57+ zip -r "$ZIP_NAME" package.json Runtime/ Editor/ Resources/ -x "*.meta"
8058 echo "ZIP_NAME=$ZIP_NAME" >> "$GITHUB_ENV"
81-
8259 - name : Create GitHub Release and Upload Assets
8360 uses : softprops/action-gh-release@v2
8461 with :
@@ -87,11 +64,10 @@ jobs:
8764 generate_release_notes : true
8865 files : |
8966 ${{ env.ZIP_NAME }}
90-
9167 - name : Trigger workflow in another repo
9268 uses : peter-evans/repository-dispatch@v2
9369 with :
9470 token : ${{ secrets.VPM_KEY }}
9571 repository : BitforgedVR/VPM
9672 event-type : build-repo-listing
97- client-payload : ' {"ref": "${{ github.ref }}"}'
73+ client-payload : ' {"ref": "${{ github.ref }}"}'
0 commit comments