1+ # Description
2+ # ===========
3+ # This workflow is triggered each time a milestone is closed
4+ # It builds the jar, generates release notes, pushes a new tag
5+ # and makes a draft release with these elements.
6+ ---
7+ name : Release
8+
9+ on :
10+ workflow_dispatch :
11+ inputs :
12+ draft :
13+ description : ' Est-ce que la release doit être en brouillon?'
14+ default : true
15+ required : false
16+ type : boolean
17+ prerelease :
18+ description : " Est-ce que c'est une pre-release?"
19+ default : true
20+ required : false
21+ type : boolean
22+ tag :
23+ description : " Spécifier le tag git?"
24+ required : true
25+ type : string
26+ maven_release_version :
27+ description : " Spécifier la version de release? Conseil: Utiliser la même version que le tag"
28+ required : true
29+ type : string
30+ maven_development_version :
31+ description : " Spécifier la nouvelle version de développement après la release? Ex : X.X.X-SNAPSHOT"
32+ required : true
33+ type : string
34+
35+
36+ jobs :
37+ release :
38+ runs-on : ubuntu-latest
39+ permissions :
40+ contents : write
41+ packages : write
42+ steps :
43+ - name : Check out repository code
44+ uses : actions/checkout@v4
45+ - name : Setup java
46+ uses : actions/setup-java@v4
47+ with :
48+ distribution : ' temurin'
49+ java-version : ' 11'
50+ - name : Maven install with new version
51+ run : |
52+ mvn -B versions:set-property -Dproperty=revision -DnewVersion="${{ inputs.maven_release_version }}"
53+ mvn -B -P prod install
54+ # the latest version at https://github.com/marketplace/actions/official-sonarqube-scan
55+ # Triggering SonarQube analysis as results of it are required by Quality Gate check.
56+ - name : SonarQube Scan
57+ uses : SonarSource/sonarqube-scan-action@v4.2.1
58+ with :
59+ args : >
60+ -Dsonar.qualitygate.wait=true
61+ -Dsonar.qualitygate.timeout=600
62+ env :
63+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
64+ - name : Commit and tag project
65+ run : |
66+ git config --global user.name "GitHub Actions"
67+ git config --global user.email catlab@cnes.fr
68+ git add pom.xml
69+ git commit -m "Release ${{ inputs.tag }}"
70+ git push
71+ git tag ${{ inputs.tag }} -m "Release ${{ inputs.tag }}"
72+ git push origin ${{ inputs.tag }}
73+ env :
74+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+ - name : Maven deploy
76+ run : |
77+ mvn -B -P prod deploy
78+ env :
79+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
80+ - name : Bump up version in branch to next development version
81+ run : |
82+ git config --global user.name "GitHub Actions"
83+ git config --global user.email catlab@cnes.frs
84+ mvn -B versions:set-property -Dproperty=revision -DnewVersion=${{ inputs.maven_development_version }}
85+ git add pom.xml
86+ git commit -m "Next development version is ${{ inputs.maven_development_version }}"
87+ git push
88+ env :
89+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
90+ - name : Set project values
91+ run : |
92+ echo "project=$(echo ${{ github.repository }} | awk -F '/' '{print $2}')" >> $GITHUB_ENV
93+ - name : Create GitHub Release
94+ uses : ncipollo/release-action@v1
95+ env :
96+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
97+ with :
98+ artifacts : " icode-app/target/icode-*.zip"
99+ tag : ${{ inputs.tag }}
100+ name : ${{ env.project }} ${{ inputs.tag }}
101+ draft : ${{inputs.draft}}
102+ generateReleaseNotes : true
103+ prerelease : ${{inputs.prerelease}}
104+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments