Update dependencies and fix buffer import #12
Workflow file for this run
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 | |
on: | |
pull_request: | |
branches: | |
- master | |
types: [closed] | |
env: | |
CI: true | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Pull Request Merged | |
if: github.event.pull_request.merged == false | |
run: | | |
echo 'The pull request has not been merged' | |
exit 1 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set git config | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: "https://registry.npmjs.org" | |
- name: Setup .npmrc | |
shell: bash | |
run: | | |
npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
- name: Ensure access | |
shell: bash | |
run: npm whoami --registry https://registry.npmjs.org/ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
- name: Install global dependencies | |
run: npm i standard-version yarn -g | |
- name: Install dependencies | |
run: yarn | |
- name: Get Prev Version | |
shell: bash -ex {0} | |
run: | | |
PREV_VERSION=$(node -p 'require("./package.json").version') | |
echo "::set-env name=PREV_VERSION::${PREV_VERSION}" | |
- name: Bump version | |
run: | | |
standard-version | |
- name: Get Current Version | |
shell: bash -ex {0} | |
run: | | |
CURRENT_VERSION=$(node -p 'require("./package.json").version') | |
echo "::set-env name=CURRENT_VERSION::${CURRENT_VERSION}" | |
- name: Publish | |
if: env.PREV_VERSION != env.CURRENT_VERSION | |
run: | | |
npm run build | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
- name: Push changes | |
uses: ad-m/[email protected] | |
if: env.PREV_VERSION != env.CURRENT_VERSION | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true | |
- name: Create comment | |
uses: actions/[email protected] | |
if: env.PREV_VERSION != env.CURRENT_VERSION | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'NPM package v${{ env.CURRENT_VERSION }} has been published 🎉' | |
}) |