Bump version app and create PR #14
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: Bump version Publish NT CSS Framework | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Semver type of new version (major / minor / patch)' | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
- name: Setup Git | |
run: | | |
git config user.name 'khoilen' | |
git config user.email '[email protected]' | |
- name: bump version | |
id: bump-version | |
run: | | |
pnpm version ${{ github.event.inputs.version }} || true | |
version=$(jq -r '.version' ./package.json) | |
echo "Bumped version: $version" | |
echo "new_version=$version" >> $GITHUB_ENV | |
working-directory: apps/nt-stylesheet | |
continue-on-error: true | |
- name: Push latest version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
if [ "${{ env.new_version }}" != "unknown" ]; then | |
git checkout -b bump-version-${{ env.new_version }} | |
git add . | |
git commit -m "Bump version to ${{ env.new_version }}" | |
git tag "v${{ env.new_version }}" | |
git push origin bump-version-${{ env.new_version }} --follow-tags | |
else | |
echo "Skipping push due to unknown version" | |
fi | |
working-directory: apps/nt-stylesheet | |
- name: Create Pull Request | |
if: env.new_version != 'unknown' | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: bump-version-${{ env.new_version }} | |
title: "Bump version to ${{ env.new_version }}" | |
body: "This PR bumps the version to ${{ env.new_version }}." | |
labels: version-bump | |
delete-branch: true | |
assignees: khoilen | |
reviewers: khoilen |