Skip to content

Release new version #24

Release new version

Release new version #24

Workflow file for this run

name: Publish new version
on:
workflow_dispatch:
inputs:
version:
type: choice
description: Version
options:
- patch
- minor
- major
- prerelease
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
# Needed to make possible changelog generation only from latest tag
with:
fetch-depth: 0
fetch-tags: true
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- name: Auth in GitHub private registry npm
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
echo "@1inch:registry=https://npm.pkg.github.com" >> .npmrc
- name: Install Dependencies
run: pnpm install
- name: Security
run: pnpm audit
- name: Bump package.json version
id: version
run: |
echo "OLD_VERSION=$(pnpm pkg get version | tr -d '"')" >> "$GITHUB_OUTPUT"
pnpm version ${{ github.event.inputs.version }} --preid rc --git-tag-version=false
echo "NEW_VERSION=$(pnpm pkg get version | tr -d '"')" >> "$GITHUB_OUTPUT"
- name: Generate changelog
run: pnpm changelog:generate -t v${{ steps.version.outputs.OLD_VERSION }} || pnpm changelog:generate
- name: Publish
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create github release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email [email protected]
git config --global user.name "CI/CD Bot"
git add package.json
git commit -m "version v${{ steps.version.outputs.NEW_VERSION }}"
git tag v${{ steps.version.outputs.NEW_VERSION }}
git push
git push --tags
gh release create v${{ steps.version.outputs.NEW_VERSION }} --notes-file CHANGELOG.md