Publish #25
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: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
versionType: | |
type: choice | |
description: "<major|minor|patch>" | |
required: true | |
default: "patch" | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
publish: | |
name: Publish ${{ inputs.versionType }} release | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Prepare Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install | |
run: pnpm i | |
- id: update-version | |
shell: bash | |
name: Bump version | |
# Use npm because yarn is for some reason not able to output only the version name | |
run: | | |
echo "version=$(pnpm run publish ${{ inputs.versionType }} | tail -n1)" >> $GITHUB_OUTPUT | |
git add . | |
- name: Conventional Changelog Action | |
id: build-changelog | |
uses: TriPSs/conventional-changelog-action@v5 | |
with: | |
github-token: ${{ secrets.github_token }} | |
git-message: "chore(release): {version} 🤖" | |
git-user-name: "github-actions[bot]" | |
git-user-email: "41898282+github-actions[bot]@users.noreply.github.com" | |
preset: "conventionalcommits" | |
tag-prefix: "v" | |
# output-file: "UPDATELOG.md" # Since v1.4.3, using conventional-changelog-cli@v2.1.0 | |
release-count: "10" | |
pre-changelog-generation: ".github/conventional-changelog/pre-changelog-generation.cjs" | |
config-file-path: ".github/conventional-changelog/config.cjs" | |
git-branch: "main" | |
env: | |
NYANPASU_VERSION: ${{ steps.update-version.outputs.version }} | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
body: ${{steps.build-changelog.outputs.clean_changelog}} | |
name: Clash Nyanpasu v${{steps.update-version.outputs.version}} | |
tag_name: ${{steps.build-changelog.outputs.tag}} | |
# target_commitish: ${{ steps.tag.outputs.sha }} |