Skip to content

Merge pull request #87 from aelf-lxy/master #7

Merge pull request #87 from aelf-lxy/master

Merge pull request #87 from aelf-lxy/master #7

Workflow file for this run

name: publish
env:
CI: true
on:
push:
branches:
- master
tags:
- '!*'
jobs:
release:
name: Setup
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://npm.pkg.github.com'
- name: install
run: yarn install
- name: lint
run: yarn run lint
# Publish to npm if this version is not published
- name: publish
run: |
npx can-npm-publish --verbose
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish || (echo "npm publish failed" && exit 1)
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 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'