Create Release #13
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: Create Release | |
# This uses the release-it repo to version bump and plublish | |
# See: https://github.com/release-it/release-it | |
# Below was initially blatenly copied from bot axios/axios and js-cookie/js-cookie | |
# See: https://github.com/axios/axios/blob/v1.x/.github/workflows/release.yml | |
# See: https://github.com/js-cookie/js-cookie/blob/main/.github/workflows/release.yml | |
# For the ROOt/.release-it.json file, | |
# See: https://github.com/js-cookie/js-cookie/blob/main/.release-it.json | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: choice | |
description: Choose release type | |
options: | |
- auto | |
- patch | |
- minor | |
- major | |
default: auto | |
dry-run: | |
type: boolean | |
description: Perform dry-run | |
default: true | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: chainguard-dev/actions/setup-gitsign@main | |
- name: Create Release | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Initialise the NPM config | |
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
- name: Initialize Git user | |
run: | | |
git config --global user.email "fr3nch13@gmail.com" | |
git config --global user.name "Release Workflow" | |
- name: Log git status | |
run: git status | |
- name: Push to protected branch | |
uses: CasperWA/push-protected@v2 | |
with: | |
token: ${{ secrets.PUSH_TO_PROTECTED_BRANCH }} | |
branch: main | |
unprotect_reviews: true | |
- name: Run release | |
run: | | |
npm whoami | |
npm install | |
# See ROOt/.release-it.sh | |
# That defines how the release command behaves. | |
npm run release -- --ci --verbose ${{ github.event.inputs.version }}${{ github.event.inputs.dry-run == 'true' && ' --dry-run' || '' }} |