Skip to content

Update JS-DevTools/npm-publish action to v2 - autoclosed #355

Update JS-DevTools/npm-publish action to v2 - autoclosed

Update JS-DevTools/npm-publish action to v2 - autoclosed #355

Workflow file for this run

name: Publish package
on:
pull_request:
branches:
- master
types: [closed]
jobs:
publish:
runs-on: ubuntu-20.04
if: github.event.pull_request.merged == true
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: -1
- name: Use Node.js "14.x"
uses: actions/setup-node@v3
with:
cache: npm
node-version: "14.x"
- name: Install dependencies
run: npm install
env:
CI: true
- name: Check availability
id: check_availability
run: npx can-npm-publish
continue-on-error: true
- name: Check tag
id: check_tag
run: |
TAG=v$(jq -r ".version" package.json)
if git show-ref --tags | grep -q "refs/tags/${TAG}"
then
echo "${TAG} exists."
exit 1
else
echo "${TAG} does not exist. It will add to this repository."
fi
continue-on-error: true
- name: Publish
id: npm_publish
if: steps.check_availability.outcome == 'success' && steps.check_tag.outcome == 'success'
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Tagging
if: steps.npm_publish.conclusion == 'success'
run: |
TAG=v$(jq -r ".version" package.json)
git tag ${TAG}
git push origin --tags
- name: Post comment
uses: mshick/add-pr-comment@v2
if: steps.check_availability.outcome == 'success' && steps.check_tag.outcome == 'success'
with:
message: |
Thank you for your contributions!
We publish new version of this package.
Cheers!
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: "github-actions[bot]"
allow-repeats: false
- name: Post comment
uses: mshick/add-pr-comment@v2
if: steps.check_availability.outcome == 'failure' || steps.check_tag.outcome == 'failure'
with:
message: |
Thank you for your contributions!
We include your contributions in next release.
Cheers!
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: "github-actions[bot]"
allow-repeats: false