Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: 🧪 Test Actions

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-fusion-publish:
name: 🧪 Test Fusion Publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: 📥 Checkout
uses: actions/checkout@v4

- name: 🟢 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'fusion-publish/package.json'

- name: 📦 Install dependencies
working-directory: fusion-publish
run: npm ci

- name: 🔨 Build action
working-directory: fusion-publish
run: npm run build

- name: ✅ Check built action
working-directory: fusion-publish
run: |
if [ -f "dist/index.js" ] || [ -f "dist/index.js" ]; then
echo "✅ Built action found"
else
echo "❌ Built action not found"
exit 1
fi
shell: bash

test-action-dry-run:
name: 🧪 Test Action (Dry Run)
runs-on: ubuntu-latest
needs: test-fusion-publish

steps:
- name: 📥 Checkout
uses: actions/checkout@v4

- name: 🟢 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'fusion-publish/package.json'

- name: 📦 Build action
working-directory: fusion-publish
run: |
npm ci
npm run build

# This tests that the action loads and validates inputs correctly
# It will fail at the actual Nitro command (which is expected)
- name: 🎯 Test Action Setup
uses: ./fusion-publish
with:
tag: 'test-v1.0.0'
stage: 'testing'
api-id: 'test-api'
api-key: 'test-key'
continue-on-error: true

create-tags:
name: 🏷️ Create/Update Tags
runs-on: ubuntu-latest
needs: [test-fusion-publish, test-action-dry-run]
if: github.ref == 'refs/heads/main'

steps:
- name: 📥 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🟢 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: 🔨 Build all actions
run: |
cd fusion-publish
npm ci
npm run build
cd ..

- name: 📋 Commit built files
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add fusion-publish/dist/
git diff --staged --quiet || git commit -m "🔨 Update built actions"

- name: 🏷️ Create/update version tags
run: |
git tag -fa v1 -m "Update v1 tag"
git push origin v1 --force

# Create v1.0 tag if it doesn't exist
if ! git rev-parse v1.0 >/dev/null 2>&1; then
git tag v1.0 -m "Create v1.0 tag"
git push origin v1.0
fi
Loading
Loading