Skip to content

Commit

Permalink
add bump version workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ergofriend committed Oct 4, 2024
1 parent c98cf1f commit a361238
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/api/createCommitOnBranch.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mutation (
$githubRepository: String!
$branchName: String!
$expectedHeadOid: GitObjectID!
$commitMessage: String!
$files: [FileAddition!]!
) {
createCommitOnBranch(
input: {
branch: {
repositoryNameWithOwner: $githubRepository
branchName: $branchName
}
message: { headline: $commitMessage }
fileChanges: { additions: $files }
expectedHeadOid: $expectedHeadOid
}
) {
commit {
url
}
}
}
43 changes: 43 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Bump version"

on:
workflow_dispatch:
inputs:
version:
required: true
default: "patch"
type: choice
options:
- major
- minor
- patch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: corepack enable
- name: Setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Bump version
id: bump_version
shell: bash
run: |
pnpm version ${{ github.event.inputs.version }} --no-commit-hooks --no-git-tag-version
echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
- name: commit
run: |
gh api graphql \
-F $githubRepository=$GITHUB_REPOSITORY \
-F branchName=$BRANCH \
-F expectedHeadOid=$(git rev-parse HEAD) \
-F commitMessage=":robot: Bump version to ${{ steps.bump_version.outputs.VERSION }}" \
-F files[][path]="package.json" -F files[][contents]=$(base64 -w0 package.json) \
-F '[email protected]/api/createCommitOnBranch.gql'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a361238

Please sign in to comment.