Version up #1
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: Version up | |
on: | |
workflow_dispatch: | |
inputs: | |
semantic: | |
description: Semantic versioning | |
required: true | |
default: patch | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
version-up: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Package | |
run: | | |
npm ci | |
npm run package | |
- name: Version up | |
id: version | |
run: | | |
set -x | |
version=$(npm --no-git-tag-version version $SEMANTIC) | |
echo "::set-output name=version::${version}" | |
sed -i -e "s|${GITHUB_REPOSITORY}@v[.0-9]\+|${GITHUB_REPOSITORY}@${version}|g" README.md | |
git diff | |
env: | |
SEMANTIC: ${{ github.event.inputs.semantic }} | |
- uses: snow-actions/[email protected] | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Commit & PR | |
run: | | |
set -x | |
branch="release/${VERSION}" | |
git switch -c ${branch} | |
git add . | |
git commit -m "${VERSION}" | |
git push origin ${branch} | |
gh pr create --base ${GITHUB_REF_NAME} --head ${branch} --assignee ${GITHUB_ACTOR} --title ${VERSION} --body '' | |
env: | |
VERSION: ${{ steps.version.outputs.version }} | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} |