Release npm package #32
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: Release npm package | |
on: | |
workflow_dispatch: | |
inputs: | |
version-bump: | |
description: The scale of the version bump required for semver compatibility | |
required: true | |
default: patch | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
concurrency: release | |
jobs: | |
release: | |
name: "Release & Publish" | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🧮 Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
token: ${{ secrets.ELEMENT_BOT_TOKEN }} | |
- name: 🔧 Set up node environment | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 | |
with: | |
node-version: "18" | |
cache: "yarn" | |
- name: 🛠️ Setup | |
run: yarn install --pure-lockfile | |
- name: 👊 Bump version | |
run: | | |
yarn version --no-git-tag-version --${{ github.event.inputs.version-bump }} | |
yarn format --write | |
git config --global user.name 'ElementRobot' | |
git config --global user.email '[email protected]' | |
git commit -am "${{ github.event.inputs.version-bump }} version bump" | |
git push | |
- name: 🚀 Publish to npm | |
id: npm-publish | |
uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3 | |
with: | |
token: ${{ secrets.ELEMENT_NPM_TOKEN }} | |
access: public | |
- name: 🧬 Create release | |
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.npm-publish.outputs.version }} | |
release_name: Release ${{ steps.npm-publish.outputs.version }} | |
body: ${{ steps.npm-publish.outputs.version }} Release | |
draft: false | |
prerelease: false |