Trigger deploy again #2
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: Publish plugin to NPM | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout V3 action" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: "Automated version bump" | |
uses: "phips28/gh-action-bump-version@master" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
default: patch | |
commit-message: "Version bump to {{version}} [skip ci]" | |
tag-prefix: "v" | |
- name: "Export package version" | |
id: package | |
run: | | |
echo "package_version=`cat package.json | jq -r .version`" >> $GITHUB_ENV | |
shell: bash | |
- name: "Echo package version" | |
run: echo ${{ env.package_version }} | |
- name: "Find and Replace" | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "[3-9]+\\.[0-9]+\\.[0-9]+" | |
replace: ${{ env.package_version }} | |
regex: true | |
include: "README.md" | |
- name: "Version bump in README.md to {{version}} [skip ci]" | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Version bump in README.md to ${{ env.package_version }} [skip ci]" | |
file_pattern: README.md | |
- name: "Node.js setup" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Install PNPM" | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: "Install dependencies" | |
run: pnpm install | |
- name: "NPM Publish" | |
uses: JS-DevTools/npm-publish@v1 | |
id: publish | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
check-version: true | |
dry-run: false | |
access: "public" | |
- if: steps.publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Create new release" | |
if: steps.publish.outputs.type != 'none' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: "v${{ steps.publish.outputs.version }}" | |
release_name: "v${{ steps.publish.outputs.version }}" | |
draft: false | |
prerelease: false |