Skip to content

Commit a0a1528

Browse files
committed
feat: Setup UPM package distribution
- Added package.json for com.caspernetwork.sdk - Added GitHub Action to auto-publish to UPM repo on main push - Renamed Samples to Samples~ (UPM convention) - Updated README with new installation URLs Requires: Create com.caspernetwork.sdk repo and UPM_DEPLOY_TOKEN secret
1 parent e2b8c05 commit a0a1528

17 files changed

Lines changed: 92 additions & 5 deletions

.github/workflows/publish-upm.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish UPM Package
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'Assets/CasperSDK/**'
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout source repo
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Git
19+
run: |
20+
git config --global user.name "GitHub Actions"
21+
git config --global user.email "actions@github.com"
22+
23+
- name: Get version from package.json
24+
id: version
25+
run: |
26+
VERSION=$(cat Assets/CasperSDK/package.json | jq -r '.version')
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
29+
- name: Push to UPM repo
30+
env:
31+
UPM_REPO: github.com/SamDreamsMaker/com.caspernetwork.sdk.git
32+
GH_TOKEN: ${{ secrets.UPM_DEPLOY_TOKEN }}
33+
run: |
34+
# Create temp directory
35+
mkdir -p /tmp/upm-package
36+
37+
# Copy package contents
38+
cp -r Assets/CasperSDK/* /tmp/upm-package/
39+
40+
# Initialize git in package folder
41+
cd /tmp/upm-package
42+
git init
43+
git add .
44+
git commit -m "Release v${{ steps.version.outputs.version }}"
45+
46+
# Push to UPM repo
47+
git remote add upm https://${GH_TOKEN}@${UPM_REPO}
48+
git push upm HEAD:main --force
49+
50+
# Create version tag
51+
git tag v${{ steps.version.outputs.version }}
52+
git push upm v${{ steps.version.outputs.version }} --force
53+
54+
- name: Summary
55+
run: |
56+
echo "## 📦 UPM Package Published" >> $GITHUB_STEP_SUMMARY
57+
echo "Version: v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
58+
echo "Repo: https://github.com/SamDreamsMaker/com.caspernetwork.sdk" >> $GITHUB_STEP_SUMMARY
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Assets/CasperSDK/Samples/CasperWalletDemoController.cs renamed to Assets/CasperSDK/Samples~/CasperWalletDemoController.cs

File renamed without changes.

Assets/CasperSDK/Samples/CasperWalletDemoController.cs.meta renamed to Assets/CasperSDK/Samples~/CasperWalletDemoController.cs.meta

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)