Publish #7
This file contains 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 | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: 'Dry run' | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3.6.0 | |
with: | |
node-version: 16.x | |
- name: Install Dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: NPM Publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
access: public | |
token: ${{ secrets.NPM_TOKEN }} | |
dry-run: ${{ github.event.inputs.dry-run == 'true' }} | |
draft-release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.event.inputs.dry-run != 'true' | |
permissions: write-all | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get version | |
id: version | |
run: echo "version=$(node -p 'require(`./package.json`).version')" >> $GITHUB_ENV | |
shell: bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.version }} | |
release_name: Release v${{ env.version }} | |
body: | | |
Auto-generated release | |
draft: true | |
prerelease: false |