Deploy Version #19
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 Version | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to increment (major, minor or patch)' | |
| required: true | |
| default: 'patch' | |
| jobs: | |
| npm: | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION: ${{ github.event.inputs.version }} | |
| steps: | |
| - run: | | |
| if [[ "$VERSION" != "major" ]] && [[ "$VERSION" != "minor" ]] && [[ "$VERSION" != "patch" ]]; then | |
| echo "Input should be either 'major', 'minor' or 'patch'" | |
| exit 1 | |
| fi | |
| - run: | | |
| git config --global user.name "${{ secrets.GIT_USER_NAME }}" | |
| git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4.2.0 | |
| with: | |
| node-version: 14.x | |
| - run: npm ci | |
| - run: npm version $VERSION | |
| - name: NPM Publish | |
| uses: JS-DevTools/npm-publish@v3 | |
| with: | |
| token: ${{ secrets.NPM_TOKEN }} | |
| - run: | | |
| echo "TAG=$(npm run env | grep npm_package_version | cut -d '=' -f 2)" >> $GITHUB_ENV | |
| - name: Create Github Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: refs/tags/${{ env.TAG }} | |
| release_name: Version ${{ env.TAG }} | |
| body: Version ${{ env.TAG }} | |