|
| 1 | +name: Patch |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + if: "!startsWith(github.event.head_commit.message, 'Release v') && github.event.base_ref != 'refs/heads/main'" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Set up JDK 17 |
| 14 | + uses: actions/setup-java@v1 |
| 15 | + with: |
| 16 | + java-version: 17 |
| 17 | + |
| 18 | + - name: Checkout sources |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Delete original tag |
| 24 | + run: | |
| 25 | + git tag -d ${{ github.ref_name }} |
| 26 | + git push origin :refs/tags/${{ github.ref_name }} |
| 27 | +
|
| 28 | + - name: Change Maven version to release version |
| 29 | + run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.${{ env.GITHUB_PATCH_VERSION }} |
| 30 | + |
| 31 | + - name: Commit and tag release version |
| 32 | + run: | |
| 33 | + git config --global user.name "github-actions[bot]" |
| 34 | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 35 | + git checkout -b ${{ github.event.base_ref }} |
| 36 | + git add . |
| 37 | + git commit -m "Release ${{ github.ref_name }}" |
| 38 | + git tag ${{ github.ref_name }} |
| 39 | +
|
| 40 | + - name: Build with Maven |
| 41 | + run: mvn --batch-mode -Pjacoco verify |
| 42 | + |
| 43 | + - name: Run SonarCloud analysis |
| 44 | + run: > |
| 45 | + mvn --batch-mode -DskipTests sonar:sonar |
| 46 | + -Dsonar.host.url=https://sonarcloud.io |
| 47 | + -Dsonar.organization=gridsuite |
| 48 | + -Dsonar.projectKey=gridsuite_spreadsheet-config-server |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 52 | + |
| 53 | + - name: Build Docker image |
| 54 | + run: > |
| 55 | + mvn --batch-mode deploy -DskipTests -Dmaven.install.skip -Dmaven.deploy.skip -Dpowsybl.docker.deploy |
| 56 | + -Djib.httpTimeout=60000 |
| 57 | + -Djib.to.image=docker.io/gridsuite/spreadsheet-config-server:${GITHUB_REF_NAME#v} |
| 58 | + -Djib.to.auth.username=gridsuiteci |
| 59 | + -Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }} |
0 commit comments