Bump CS Version in REPO #630
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
############################################################################# | |
# GitHub Action to Bump Checkstyle Version in repository. | |
# | |
# Workflow starts every day at the end of the day. | |
# | |
############################################################################# | |
name: "Bump CS Version in REPO" | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
bump: | |
if: github.repository == 'checkstyle/contribution' | |
name: Bump CS version in REPO | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the latest code | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Version | |
id: VERSION | |
run: | | |
MAVEN_METADATA=https://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/maven-metadata.xml | |
LATEST_VERSION=$(curl $MAVEN_METADATA | grep -oPm1 "(?<=<latest>)[^<]+") | |
echo "::set-output name=LATEST_VERSION::$LATEST_VERSION" | |
- name: Run Shell Script | |
run: | | |
./.ci/bump-cs-version-in-patch-diff-report-tool.sh ${{ steps.VERSION.outputs.LATEST_VERSION }} | |
./.ci/bump-cs-version-in-releasenotes-builder.sh ${{ steps.VERSION.outputs.LATEST_VERSION }} | |
- name: Commit and Push | |
run: | | |
if [ "$(git status | grep 'Changes not staged\|Untracked files')" ]; then | |
git diff | |
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 project version to ${{ steps.VERSION.outputs.LATEST_VERSION }}" | |
git push | |
fi |