Deploy #16
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: Deploy | |
| permissions: read-all | |
| on: workflow_dispatch | |
| jobs: | |
| publish-npm: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - name: Setup Emscripten | |
| uses: mymindstorm/setup-emsdk@v14 | |
| with: | |
| version: 3.1.74 | |
| - name: Install dependencies | |
| run: pnpm --color install | |
| - name: Build | |
| run: pnpm build | |
| - name: Read version from package.json | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_ENV | |
| - name: Create Git tag | |
| run: | | |
| git tag ${{ env.version }} | |
| git push origin ${{ env.version }} | |
| - name: Publish to NPM | |
| uses: JS-DevTools/npm-publish@v3 | |
| with: | |
| access: public | |
| token: ${{ secrets.NPM_TOKEN }} |