Skip to content

Commit

Permalink
Issue #11900: created Github action that does version bump and update…
Browse files Browse the repository at this point in the history
… Milestone ID
  • Loading branch information
Rahulkhinchi03 authored and romani committed Aug 14, 2022
1 parent 35ab9f1 commit 3d65e6c
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .ci/bump-version.sh
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

VERSION=$1
echo VERSION="$VERSION"

echo "bump version in pom.xml"
mvn -e --no-transfer-progress versions:set -DnewVersion="$VERSION"
mvn -e --no-transfer-progress versions:commit
1 change: 1 addition & 0 deletions .ci/jsoref-spellchecker/whitelist.words
Expand Up @@ -337,6 +337,7 @@ Djacoco
Dlinkcheck
DMail
Dmaven
Dnew
doccheck
DOCKERHUB
Dockter
Expand Down
21 changes: 21 additions & 0 deletions .ci/update-github-milestone.sh
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

source ./.ci/util.sh

checkForVariable "READ_ONLY_TOKEN"

VERSION=$1

echo "Updating milestone at github"
MILESTONE_ID=$(curl -s \
-X GET https://api.github.com/repos/checkstyle/checkstyle/milestones?state=open \
| jq ".[0] | .number")

echo VERSION="$VERSION"
echo MILESTONE_ID="$MILESTONE_ID"

curl \
-X PATCH https://api.github.com/repos/checkstyle/checkstyle/milestones/"$MILESTONE_ID" \
-H "Authorization: token $READ_ONLY_TOKEN" \
-d "{ \"title\": \"$VERSION\" }"
42 changes: 42 additions & 0 deletions .github/workflows/bump-version-and-update-milestone.yml
@@ -0,0 +1,42 @@
#############################################################################
# GitHub Action to bump release version
#
#############################################################################
name: "Bump version and Update Milestone"
on:
workflow_dispatch:
inputs:
version:
description: 'New Version'
required: true
permissions:
contents: write
pull-requests: write
jobs:
printInputs:
runs-on: ubuntu-latest
steps:
- run: |
echo "Latest Version: ${{ github.event.inputs.version }}"
bump:
name: Bump version
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Modify File
run: |
./.ci/bump-version.sh ${{ github.event.inputs.version }}
- name: Push commit
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "minor: Bump release version to ${{ github.event.inputs.version }}"
git push
- name: GitHub Milestone
run: |
.ci/update-github-milestone.sh ${{ github.event.inputs.version }}
env:
READ_ONLY_TOKEN: ${{ github.token }}

0 comments on commit 3d65e6c

Please sign in to comment.