Skip to content

Commit b83765d

Browse files
chore: enhance workflow to handle patches
Signed-off-by: Joris Mancini <[email protected]>
1 parent 98bb357 commit b83765d

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

.github/workflows/patch.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v[0-9]*'
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77

88
jobs:
99
build:
10-
if: "!startsWith(github.event.head_commit.message, 'Release v')"
10+
if: "!startsWith(github.event.head_commit.message, 'Release v') && github.event.base_ref == 'refs/heads/main'"
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Set up JDK 17

0 commit comments

Comments
 (0)