Release #6
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: | |
releaseType: | |
description: 'Release type (one of): patch, minor, major' | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.HEXANCORE_BOT_TOKEN }} | |
env: | |
HEXANCORE_BOT_TOKEN: ${{ secrets.HEXANCORE_BOT_TOKEN }} | |
- name: Yarn install | |
uses: hexancore/[email protected] | |
- name: test | |
uses: ./.github/actions/test | |
# Bump version | |
- name: Bump package version | |
shell: bash | |
run: | | |
yarn version $RELEASE_TYPE | |
echo "RELEASE_TAG=latest" >> $GITHUB_ENV | |
echo "NEW_VERSION=$(jq -r '.version' < package.json)" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ inputs.releaseType }} | |
- name: Update CHANGELOG.md | |
uses: 'zen8sol/[email protected]' | |
with: | |
newVersion: '${{ env.NEW_VERSION }}' | |
# Publish package | |
- name: Publish | |
shell: bash | |
run: | | |
echo -e "\nnpmAuthToken: '${{ env.NODE_AUTH_TOKEN }}'" >> ./.yarnrc.yml | |
yarn npm publish --access public --tag ${{ env.RELEASE_TAG }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Commit | |
- name: Commit CHANGELOG.md and package.json changes and create tag | |
shell: bash | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Hexancore Bot" | |
git add "package.json" | |
git add "CHANGELOG.md" | |
git commit -m "chore: release ${{ env.NEW_VERSION }}" | |
git tag -m 'new version' ${{ env.NEW_VERSION }} | |
git push --follow-tags | |
#- name: publish | |
# uses: ./.github/actions/publish |