Skip to content

Patch

Patch #7

Workflow file for this run

name: Patch
on:
workflow_dispatch:
inputs:
releaseVersion:
description: Patch version (vX.X)
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Checkout on existing release branch
run: |
git checkout release/${{ github.event.inputs.releaseVersion }}
- name: Extract tag versions
run: |
lastTag=$(git describe --tags --abbrev=0)
echo $lastTag
regex="v([0-9]+).([0-9]+).([0-9]+)"
if [[ $lastTag =~ $regex ]]
then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
((patch++))
echo $major.$minor.$patch
echo "GITHUB_MAJOR_VERSION=$major" >> $GITHUB_ENV
echo "GITHUB_MINOR_VERSION=$minor" >> $GITHUB_ENV
echo "GITHUB_PATCH_VERSION=$patch" >> $GITHUB_ENV
echo "GITHUB_SHORT_VERSION=$major.$minor.$patch" >> $GITHUB_ENV
fi
- name: Change Maven version to release version
run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_SHORT_VERSION }}
- name: Commit and tag release version
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Patched release v${{ env.GITHUB_SHORT_VERSION }}"
git tag v${{ env.GITHUB_SHORT_VERSION }}
git push origin release/v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}
git push origin v${{ env.GITHUB_SHORT_VERSION }}
- name: Build with Maven
run: mvn --batch-mode -Pjacoco verify
- name: Run SonarCloud analysis
run: >
mvn --batch-mode -DskipTests sonar:sonar
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=gridsuite
-Dsonar.projectKey=gridsuite_spreadsheet-config-server
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build Docker image
run: >
mvn --batch-mode deploy -DskipTests -Dmaven.install.skip -Dmaven.deploy.skip -Dpowsybl.docker.deploy
-Djib.httpTimeout=60000
-Djib.to.image=docker.io/gridsuite/spreadsheet-config-server:${{ env.GITHUB_SHORT_VERSION }}
-Djib.to.auth.username=gridsuiteci
-Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }}