1+ name : 🧪 Test Actions
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+ branches : [main]
8+
9+ jobs :
10+ test-fusion-publish :
11+ name : 🧪 Test Fusion Publish
12+ runs-on : ${{ matrix.os }}
13+ strategy :
14+ matrix :
15+ os : [ubuntu-latest, macos-latest, windows-latest]
16+
17+ steps :
18+ - name : 📥 Checkout
19+ uses : actions/checkout@v4
20+
21+ - name : 🟢 Setup Node.js
22+ uses : actions/setup-node@v4
23+ with :
24+ node-version : ' 20'
25+ cache : ' npm'
26+ cache-dependency-path : ' fusion-publish/package.json'
27+
28+ - name : 📦 Install dependencies
29+ working-directory : fusion-publish
30+ run : npm ci
31+
32+ - name : 🔨 Build action
33+ working-directory : fusion-publish
34+ run : npm run build
35+
36+ - name : ✅ Check built action
37+ working-directory : fusion-publish
38+ run : |
39+ if [ -f "dist/index.js" ] || [ -f "dist/index.js" ]; then
40+ echo "✅ Built action found"
41+ else
42+ echo "❌ Built action not found"
43+ exit 1
44+ fi
45+ shell : bash
46+
47+ test-action-dry-run :
48+ name : 🧪 Test Action (Dry Run)
49+ runs-on : ubuntu-latest
50+ needs : test-fusion-publish
51+
52+ steps :
53+ - name : 📥 Checkout
54+ uses : actions/checkout@v4
55+
56+ - name : 🟢 Setup Node.js
57+ uses : actions/setup-node@v4
58+ with :
59+ node-version : ' 20'
60+ cache : ' npm'
61+ cache-dependency-path : ' fusion-publish/package.json'
62+
63+ - name : 📦 Build action
64+ working-directory : fusion-publish
65+ run : |
66+ npm ci
67+ npm run build
68+
69+ # This tests that the action loads and validates inputs correctly
70+ # It will fail at the actual Nitro command (which is expected)
71+ - name : 🎯 Test Action Setup
72+ uses : ./fusion-publish
73+ with :
74+ tag : ' test-v1.0.0'
75+ stage : ' testing'
76+ api-id : ' test-api'
77+ api-key : ' test-key'
78+ continue-on-error : true
79+
80+ create-tags :
81+ name : 🏷️ Create/Update Tags
82+ runs-on : ubuntu-latest
83+ needs : [test-fusion-publish, test-action-dry-run]
84+ if : github.ref == 'refs/heads/main'
85+
86+ steps :
87+ - name : 📥 Checkout
88+ uses : actions/checkout@v4
89+ with :
90+ fetch-depth : 0
91+
92+ - name : 🟢 Setup Node.js
93+ uses : actions/setup-node@v4
94+ with :
95+ node-version : ' 20'
96+
97+ - name : 🔨 Build all actions
98+ run : |
99+ cd fusion-publish
100+ npm ci
101+ npm run build
102+ cd ..
103+
104+ - name : 📋 Commit built files
105+ run : |
106+ git config user.name "github-actions[bot]"
107+ git config user.email "github-actions[bot]@users.noreply.github.com"
108+ git add fusion-publish/dist/
109+ git diff --staged --quiet || git commit -m "🔨 Update built actions"
110+
111+ - name : 🏷️ Create/update version tags
112+ run : |
113+ git tag -fa v1 -m "Update v1 tag"
114+ git push origin v1 --force
115+
116+ # Create v1.0 tag if it doesn't exist
117+ if ! git rev-parse v1.0 >/dev/null 2>&1; then
118+ git tag v1.0 -m "Create v1.0 tag"
119+ git push origin v1.0
120+ fi
0 commit comments