1.1.3 #68
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: Deployment | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
title: ^(\d+)\.(\d+)\.(\d+)$ | |
push: | |
branches: | |
- main | |
commit_message: '^(\d+)\.(\d+)\.(\d+)$' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set version from pull request or commit message | |
id: set_version | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
VERSION="${{ github.event.pull_request.title }}" | |
elif [[ "${{ github.event_name }}" == "push" ]]; then | |
VERSION="${{ github.event.head_commit.message }}" | |
fi | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Prepare for publish | |
run: | | |
./gradlew publish \ | |
-PreleaseVersion="${{ env.VERSION }}" \ | |
-Psigning.keyId="${{ secrets.SIGNING_KEY_ID }}" \ | |
-Psigning.password="${{ secrets.SIGNING_PASSWORD }}" \ | |
-Psigning.secretKeyRingFile="${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}" | |
- name: Release in Maven Central | |
run: | | |
./gradlew jreleaserRelease \ | |
-PreleaseVersion="${{ env.VERSION }}" \ | |
-PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" \ | |
-PmavenCentralPasswordToken="${{ secrets.MAVEN_CENTRAL_PASSWORD_TOKEN }}" \ | |
-PgithubToken="${{ secrets.GITHUB_TOKEN }}" | |
update-success: | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: success() | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Update README file with success badge | |
run: | | |
if [ -f "README.md" ]; then | |
sed -i "s|!\\[Deployment Status\\](https://img.shields.io/badge/deployment-.*)|![Deployment Status](https://img.shields.io/badge/deployment-success-green?style=flat)|" README.md | |
else | |
echo "README.md not found, skipping README update." | |
fi | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
message: "Update README with success deployment badge" | |
branch: "main" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
update-failed: | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: failure() | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Update README file with failed badge | |
run: | | |
if [ -f "README.md" ]; then | |
sed -i "s|!\\[Deployment Status\\](https://img.shields.io/badge/deployment-.*)|![Deployment Status](https://img.shields.io/badge/deployment-failed-red?style=flat)|" README.md | |
else | |
echo "README.md not found, skipping README update." | |
fi | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
message: "Update README with failed deployment badge" | |
branch: "main" | |
github_token: ${{ secrets.GITHUB_TOKEN }} |