release #60
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
type: choice | |
description: Release type | |
options: | |
- major | |
- minor | |
- patch | |
default: patch | |
jobs: | |
release: | |
runs-on: [ ubuntu-22.04 ] | |
environment: prod | |
steps: | |
- name: Check out branch | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Create release branch | |
run: git checkout -b release/latest | |
- name: Set git user | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '[email protected]' | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
- name: Update version in package.json | |
run: | | |
npm version ${{ inputs.release_type }} -m "${{ inputs.release_type }} release %s" | |
- name: Push new branch | |
run: git push origin release/latest | |
- name: Create pull request into main | |
uses: thomaseizinger/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
head: release/latest | |
base: master | |
title: Update version in package.json | |
reviewers: ${{ github.event.issue.user.login }} | |
body: | | |
Hi! | |
This PR was created in response workflow running. | |
I've updated the version in package.json. | |
- name: Publish package on GPR | |
run: | | |
npm config set registry https://npm.pkg.github.com | |
npm set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }} | |
npm publish | |
- name: Publish package on NPM | |
run: | | |
npm config set registry https://registry.npmjs.org | |
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_AUTH_TOKEN }} | |
npm publish |