ci: build fixes, --noEmit tsc, Dependabot and publish on any push to … #4
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: Publish to npm | ||
| on: | ||
| push: | ||
| branches: | ||
| - production | ||
| jobs: | ||
| ci: | ||
| uses: ./.github/workflows/ci.yml | ||
| publish: | ||
| needs: ci | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| registry-url: 'https://registry.npmjs.org' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build | ||
| run: npm run build | ||
| - name: Get package version | ||
| id: pkg | ||
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | ||
| - name: Set npm tag | ||
| id: tag | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| if [[ "$VERSION" == *"alpha"* ]]; then | ||
| echo "tag=alpha" >> $GITHUB_OUTPUT | ||
| elif [[ "$VERSION" == *"beta"* ]]; then | ||
| echo "tag=beta" >> $GITHUB_OUTPUT | ||
| elif [[ "$VERSION" == *"rc"* ]]; then | ||
| echo "tag=rc" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "tag=latest" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Publish to npm | ||
| run: npm publish --access public --tag ${{ steps.tag.outputs.tag }} | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - name: Create GitHub release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: v${{ steps.pkg.outputs.version }} | ||
| name: v${{ steps.pkg.outputs.version }} | ||
| generate_release_notes: true | ||
| ci: | ||
| uses: ./.github/workflows/ci.yml | ||