Workflow file for this run
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: Prepare Release Branch and Create PR | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Configure Git | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
- name: Create and push new branch | |
run: | | |
NEW_VERSION=${GITHUB_REF#refs/tags/v} | |
NEW_BRANCH=release-v${NEW_VERSION} | |
git checkout -b ${NEW_BRANCH} | |
git push origin ${NEW_BRANCH} | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
echo "NEW_BRANCH=$NEW_BRANCH" >> $GITHUB_ENV | |
- name: Update version in package.json | |
run: | | |
jq --arg new_version "$NEW_VERSION" '.version = $new_version' package.json > temp.json && mv temp.json package.json | |
- name: Build the package | |
run: yarn build | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Update version to ${{ env.NEW_VERSION }} and upgrade dependencies" | |
branch: ${{ env.NEW_BRANCH }} | |
base: main | |
title: "Release ${{ env.NEW_VERSION }}" | |
body: "This PR updates the version to ${{ env.NEW_VERSION }} and upgrades dependencies." | |
labels: release |