Merge pull request #3 from yutakobayashidev/dist #24
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: CICD | |
# Triggers when pushed to master branch | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '!*' | |
jobs: | |
release: | |
name: release-npm-package | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: setup-node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14.x | |
registry-url: 'https://registry.npmjs.org' | |
# Get current package version | |
- name: current-package-version | |
run: node -p -e '`CURRENT_PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV | |
# Create tag with current package version | |
- name: current-package-version-to-git-tag | |
uses: pkgdeps/git-tag-action@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
github_repo: ${{ github.repository }} | |
git_commit_sha: ${{ github.sha }} | |
git_tag_prefix: '' | |
version: ${{ env.CURRENT_PACKAGE_VERSION }} | |
# Publish to npm | |
- name: publish-to-npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} |