0.2.3 #15
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: npm-packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v[0-9]+*" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint | |
| - name: Run tests | |
| run: npm test | |
| env: | |
| WAVESPEED_API_KEY: ${{ secrets.WAVESPEED_API_KEY }} | |
| - name: Build package | |
| run: npm run build | |
| - name: Pack package | |
| run: npm pack | |
| - run: ls -lh *.tgz | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-packages | |
| path: | | |
| *.tgz | |
| # publish to GitHub Release | |
| gh_release: | |
| name: gh_release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| timeout-minutes: 60 | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - run: ls -R dist/ | |
| # create nightly release if it's a push to main | |
| - if: github.repository == 'WaveSpeedAI/wavespeed-javascript' && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| name: Nightly Release | |
| uses: andelf/nightly-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: nightly | |
| name: 'Nightly Release $$' | |
| prerelease: true | |
| body: 'TODO: Add nightly release notes' | |
| files: | | |
| dist/*/*.tgz | |
| # create release if it's a tag like vx.y.z | |
| - if: github.repository == 'WaveSpeedAI/wavespeed-javascript' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') | |
| name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dist/*/*.tgz |