Skip to content

Library Release

Library Release #87

name: Library Release
on:
workflow_dispatch:
inputs:
semverType:
description: "Release type"
required: true
type: choice
options:
- patch
- minor
- major
env:
NODE_VERSION: 20
NODE_CACHE: "yarn"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
token: ${{ secrets.ARABOT_PAT_TRIGGER_WORKFLOW }}
- name: Setup Node
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
cache: ${{ env.NODE_CACHE }}
- name: Update package version
run: yarn version ${{ github.event.inputs.semverType }}
- name: Get new package version
id: package-version
uses: martinbeentjes/[email protected]
- name: Update changelog
uses: actions/[email protected]
env:
version: ${{ steps.package-version.outputs.current-version}}
with:
script: |
const updateChangelog = require('./.github/workflows/scripts/update-changelog.js');
await updateChangelog({ github, context, core });
- name: Commit changes
id: commit-changes
run: |
git config --global user.name "Arabot-1"
git config --global user.email "[email protected]"
git add --all
git commit -am "Publish v${{ steps.package-version.outputs.current-version}}"
git push
echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Create tag
uses: actions/[email protected]
with:
github-token: ${{ secrets.ARABOT_PAT_TRIGGER_WORKFLOW }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/v${{ steps.package-version.outputs.current-version }}`,
sha: "${{ steps.commit-changes.outputs.commit-sha }}"
})