| push: |
| 6 | branches: |
| 7 | - main |
| 8 |
| 9 | permissions: |
| 10 | contents: write |
| 11 | id-token: write |
| 12 |
| 13 | jobs: |
| 14 | deploy: |
| 15 | runs-on: ubuntu-latest |
| 16 | steps: |
| 17 | - name: Checkout |
| 18 | uses: actions/checkout@v7 |
| 19 |
| 20 | - name: Install Node.js |
| 21 | uses: actions/setup-node@v7 |
| 22 | with: |
| 23 | node-version: lts/* |
| 24 | package-manager-cache: false |
| 25 |
| 26 | - name: NPM install |
| 27 | run: npm install |
| 28 |
| 29 | - name: NPM build |
| 30 | run: | |
| 31 | npm run build |
| 32 |
| 33 | - name: NPM build for release |
| 34 | run: | |
| 35 | npm pack --pack-destination dist |
| 36 |
| 37 | - name: Delete existing release |
| 38 | env: |
| 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | run: | |
| 41 | gh release delete v0.0.0 --yes || true |
| 42 | git push --delete origin v0.0.0 || true |
| 43 | git tag -d v0.0.0 || true |
| 44 |
| 45 | - name: Create new release |
| 46 | env: |
| 47 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 | run: | |
| 49 | git tag v0.0.0 |
| 50 | git push origin v0.0.0 |
| 51 | gh release create v0.0.0 \ |
| 52 | --title "v0.0.0" \ |
| 53 | --notes "Development build from commit $(git rev-parse --short HEAD)" \ |
| 54 | --prerelease \ |
| 55 | dist/*.tgz |
| 56 |