Add workflow to automatically create new node release #4
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: Node Version Up | |
on: | |
workflow_dispatch: | |
inputs: | |
versioning: | |
description: "node version up: major, minor, or patch" | |
required: true | |
default: "patch" | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
name: bump version | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup user | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: install cargo-edit | |
run: | | |
cargo install cargo-edit | |
# - name: set new version ${{ github.event.inputs.versioning }} | |
- name: set new version | |
continue-on-error: false | |
run: | | |
cargo set-version --bump patch --package pendulum-node | |
# cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node | |
- name: save updated version | |
id: new-version | |
run: | | |
cd node | |
echo "version=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version')" >> "$GITHUB_OUTPUT" | |
cd .. | |
- name: save branch name | |
id: branch-name | |
run: | | |
echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" | |
git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} | |
- name: commit new version up | |
uses: chromeq/commit@v2.x | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
node/Cargo.toml | |
commit-message: "upgrade node to ${{ steps.new-version.outputs.version }}" | |
- name: push commit | |
run: | | |
git push --set-upstream origin ${{ steps.branch-name.outputs.branch_name }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6.1.0 | |
with: | |
base: "main" | |
title: "release: upgrade node to ${{ steps.new-version.outputs.version }}" | |
branch: "${{ steps.branch-name.outputs.branch_name }}" | |
body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/main...release/upgrade-node-to-${{ steps.new-version.outputs.version}})" | |
token: ${{ secrets.GITHUB_TOKEN }} |