Skip to content

Merge pull request #9 from nayounsang/tree-docs #40

Merge pull request #9 from nayounsang/tree-docs

Merge pull request #9 from nayounsang/tree-docs #40

Workflow file for this run

name: Release
on:
push:
branches:
- main
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Config identity
run: |
git config --global user.email "${{ secrets.ADMIN_EMAIL }}"
git config --global user.name "${{ secrets.ADMIN_NAME }}"
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Get NPM package version
id: get_version
run: |
PACKAGE_NAME="relation-map"
VERSION=$(npm view $PACKAGE_NAME version)
echo "npm_version=$VERSION" >> $GITHUB_ENV
- name: Update package.json version
run: |
npm version ${{ env.npm_version }} --no-git-tag-version
- name: Clean working tree
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "Working tree is clean. Skipping git add and commit."
else
git add .
git commit -m "fix: clean working tree"
fi
- name: Bump version and create new tag
run: |
npm version patch -m "chore(release): bump version to %s"
- name: Create .npmrc file
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish