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 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
node-version: 20.x | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: docker-compose up | |
run: | | |
make up | |
- name: Bump package version | |
run: | | |
echo "OLD_VERSION=$(jq -r '.version' < package.json)" >> $GITHUB_ENV | |
yarn version $RELEASE_TYPE | |
echo "NEW_VERSION=$(jq -r '.version' < package.json)" >> $GITHUB_ENV | |
echo "RELEASE_TAG=latest" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ inputs.releaseType }} | |
- name: Update CHANGELOG.md | |
uses: 'zen8sol/[email protected]' | |
with: | |
newVersion: '${{ env.NEW_VERSION }}' | |
- name: Commit CHANGELOG.md and package.json changes and create tag | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions" | |
git add "package.json" | |
git add "CHANGELOG.md" | |
git commit -m "chore: release ${{ env.NEW_VERSION }}" | |
git tag ${{ env.NEW_VERSION }} | |
- name: Publish | |
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 }} | |
- name: Push changes to repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git tag -d '${{ env.NEW_VERSION }}' | |
git tag -m 'new version' '${{ env.NEW_VERSION }}' && git push --follow-tags | |
- name: docker-compose down | |
run: | | |
make down |