Skip to content

Update Build Process #6

Update Build Process

Update Build Process #6

Workflow file for this run

name: πŸ§ͺ Test Action
on:
push:
branches: [main]
tags: ['v*'] # Added tag trigger
pull_request:
branches: [main]
permissions:
contents: write
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'
- name: πŸ“¦ Install dependencies
run: npm ci
- name: πŸ”¨ Build action
run: npm run build
- name: βœ… Check built action
run: |
if [ -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'
- name: πŸ“¦ Build action
run: |
npm ci
npm run build
- name: 🎯 Test Action Setup
uses: ./
with:
tag: 'test-v1.0.0'
stage: 'testing'
api-id: 'test-api'
api-key: 'test-key'
continue-on-error: true
create-release:
name: πŸš€ Create Release
runs-on: ubuntu-latest
needs: [test-fusion-publish, test-action-dry-run]
if: startsWith(github.ref, 'refs/tags/v') # Only run on version tags
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏷️ Get tag name
id: get-tag
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Tag: $TAG"
- name: 🟒 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: πŸ”¨ Build action
run: |
npm ci
npm run build
- name: πŸ“‹ Commit built files to tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -f dist/
if ! git diff --staged --quiet; then
git commit -m "πŸ”¨ Add built files for ${{ steps.get-tag.outputs.tag }}"
# Update the tag to point to this new commit
git tag -fa ${{ steps.get-tag.outputs.tag }} -m "Release ${{ steps.get-tag.outputs.tag }}"
git push origin ${{ steps.get-tag.outputs.tag }} --force
fi
- name: πŸ“ Generate release notes
id: generate-notes
run: |
# Generate release notes (customize as needed)
cat << EOF > release_notes.md
## What's Changed
Release ${{ steps.get-tag.outputs.tag }} of the Nitro Fusion Publish Action.
## Usage
\`\`\`yaml
- uses: ChilliCream/nitro-fusion-publish-action@${{ steps.get-tag.outputs.tag }}
with:
tag: 'v1.0.0'
stage: 'production'
api-id: 'my-api'
api-key: \${{ secrets.NITRO_API_KEY }}
\`\`\`
## Supported Platforms
- βœ… Linux (x64, ARM64)
- βœ… macOS (x64, Apple Silicon)
- βœ… Windows (x64)
**Full Changelog**: https://github.com/ChilliCream/nitro-fusion-publish-action/commits/${{ steps.get-tag.outputs.tag }}
EOF
- name: πŸš€ Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get-tag.outputs.tag }}
name: ${{ steps.get-tag.outputs.tag }}
body_path: release_notes.md
draft: false
prerelease: ${{ contains(steps.get-tag.outputs.tag, '-') }} # Mark as prerelease if tag contains - (e.g., v1.0.0-beta)
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}