Update Build Process #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |