Skip to content

chore(release): v1.5.1 #53

chore(release): v1.5.1

chore(release): v1.5.1 #53

Workflow file for this run

name: publish
on:
# When Release Pull Request is merged
pull_request:
branches:
- main
types:
- closed
env:
CI: true
permissions:
contents: write # to create tags and refs
actions: write # to cancel running workflow
issues: write # to create comment
pull-requests: write # to create comment
jobs:
publish:
if: >-
github.event.pull_request.merged &&
startsWith(github.event.pull_request.title, 'chore(release):')
name: publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '18.16.0'
- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
echo "${{github.event_name}}"
- name: Set Current Version
shell: bash -ex {0}
run: |
CURRENT_VERSION=$(node -p 'require("./package.json").version')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Install Dependencies
run: yarn
- name: Build
run: yarn build
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ github.ref_name }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.CURRENT_VERSION }}
release_name: Release v${{ env.CURRENT_VERSION }}
body: |
${{ github.event.pull_request.body }}
draft: false
prerelease: false
- name: Send pr comment
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'https://github.com/${{ github.repository }}/releases/tag/v${{ env.CURRENT_VERSION }} is released 🎉'
})