Skip to content

Commit 5d8d9a2

Browse files
committed
fix: Exclude Tests folder and orphan meta files from UPM package
- Remove Tests/ and Tests.meta from production package - Remove orphan Samples.meta (folder is Samples~)
1 parent a0a1528 commit 5d8d9a2

2 files changed

Lines changed: 67 additions & 53 deletions

File tree

.github/workflows/publish-upm.yml

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,65 @@
11
name: Publish UPM Package
22

33
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- 'Assets/CasperSDK/**'
4+
push:
5+
branches: [main]
6+
paths:
7+
- "Assets/CasperSDK/**"
88

99
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
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 (excluding Tests and orphan meta files)
38+
cp -r Assets/CasperSDK/* /tmp/upm-package/
39+
40+
# Remove Tests folder (not needed in production package)
41+
rm -rf /tmp/upm-package/Tests
42+
rm -f /tmp/upm-package/Tests.meta
43+
44+
# Remove orphan Samples.meta (folder is Samples~, not Samples)
45+
rm -f /tmp/upm-package/Samples.meta
46+
47+
# Initialize git in package folder
48+
cd /tmp/upm-package
49+
git init
50+
git add .
51+
git commit -m "Release v${{ steps.version.outputs.version }}"
52+
53+
# Push to UPM repo
54+
git remote add upm https://${GH_TOKEN}@${UPM_REPO}
55+
git push upm HEAD:main --force
56+
57+
# Create version tag
58+
git tag v${{ steps.version.outputs.version }}
59+
git push upm v${{ steps.version.outputs.version }} --force
60+
61+
- name: Summary
62+
run: |
63+
echo "## 📦 UPM Package Published" >> $GITHUB_STEP_SUMMARY
64+
echo "Version: v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
65+
echo "Repo: https://github.com/SamDreamsMaker/com.caspernetwork.sdk" >> $GITHUB_STEP_SUMMARY

Assets/CasperSDK/package.json.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)