Skip to content

Update publish-master.yml #10

Update publish-master.yml

Update publish-master.yml #10

name: publish-and-tag
env:
CI: true
on:
push:
branches:
- master
jobs:
publish-to-npm:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup Node
uses: actions/setup-node@v2
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: install
run: npm install
# Publish to npm if this version is not published
- name: publish
run: npm run publish:npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
create-tag:
runs-on: ubuntu-latest
needs: publish-to-npm
steps:
- name: checkout
uses: actions/checkout@v2
# Push tag to GitHub if package.json version's tag is not tagged
- name: package-version
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
- name: package-version-to-git-tag
uses: pkgdeps/git-tag-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
version: ${{ env.PACKAGE_VERSION }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "v"