If the version number starts with v, delete the v and keep only the n… #64
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 npm package | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'README.md' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14.x' | |
- run: npm ci | |
# - run: npm test | |
- name: Get package main version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Generate release version | |
run: | | |
echo "RELEASE_VERSION=${{ steps.package-version.outputs.current-version }}-prerelease.$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
- name: Set package version | |
run: npm --no-git-tag-version version $RELEASE_VERSION | |
- name: Tag release | |
run: | | |
git tag $RELEASE_VERSION | |
git push https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/$GITHUB_REPOSITORY $RELEASE_VERSION | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} |