chore: update to version 1.0.38 #18
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 to npm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Publish | |
runs-on: ubuntu-latest | |
environment: rep | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Install dependencies | |
run: npm install | |
- name: Publish to npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish | |
- name: Configure git identity | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: Get version from package.json | |
id: get_version | |
run: echo "::set-output name=version::$(node -p "require('./package.json').version")" | |
- name: Check if tag exists | |
run: | | |
if git rev-parse v${{ steps.get_version.outputs.version }} >/dev/null 2>&1; then | |
echo "Tag v${{ steps.get_version.outputs.version }} already exists" | |
fi | |
- name: Remove existing tag if exists | |
run: | | |
if git rev-parse v${{ steps.get_version.outputs.version }} >/dev/null 2>&1; then | |
git push --delete origin v${{ steps.get_version.outputs.version }} | |
git tag -d v${{ steps.get_version.outputs.version }} | |
fi | |
- name: Create tag | |
run: | | |
git tag -a v${{ steps.get_version.outputs.version }} -m "Version ${{ steps.get_version.outputs.version }}" | |
git push origin v${{ steps.get_version.outputs.version }} |