-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from InseeFr/develop
merge: develop in main
- Loading branch information
Showing
180 changed files
with
8,328 additions
and
2,960 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Check version | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get version | ||
id: version | ||
run: | | ||
case "${{ github.base_ref }}" in | ||
main) | ||
echo "version=$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | ||
;; | ||
develop) | ||
echo "version=$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)-rc" >> $GITHUB_OUTPUT | ||
;; | ||
*) | ||
echo "version=${{ github.base_ref }}" >> $GITHUB_OUTPUT | ||
;; | ||
esac | ||
- name: Print version | ||
run: echo ${{ steps.version.outputs.version }} | ||
|
||
- name: Find git tag | ||
if: ${{ github.base_ref == 'main' || github.base_ref == 'develop' }} | ||
uses: mukunku/[email protected] | ||
id: check-tag-exists | ||
with: | ||
tag: ${{ steps.version.outputs.version }} | ||
|
||
- name: Tag verification | ||
if: ${{ github.base_ref == 'main' || github.base_ref == 'develop' }} | ||
id: check-tag | ||
run: | | ||
if [[ "${{ steps.check-tag-exists.outputs.exists }}" == "true" ]]; then | ||
echo "Tag ${{ steps.version.outputs.version }} already exists, don't forget to upgrade your pom" | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: Release Candidate & Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'develop' | ||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-version: ${{ steps.version.outputs.version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get version | ||
id: version | ||
run: echo "version=$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)-rc" >> $GITHUB_OUTPUT | ||
|
||
- name: Print version | ||
run: echo ${{ steps.version.outputs.version }} | ||
|
||
- uses: mukunku/[email protected] | ||
name: Check tag existence | ||
id: check-tag-exists | ||
with: | ||
tag: ${{ steps.version.outputs.version }} | ||
|
||
- name: Tag verification | ||
id: check-tag | ||
run: | | ||
if [[ "${{ steps.check-tag-exists.outputs.exists }}" == "true" ]]; then | ||
echo "Nothing to tag/release, the tag ${{ steps.version.outputs.version }} already exists" | ||
exit 1 | ||
fi | ||
build-sources: | ||
needs: check-version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT | ||
id: extract_branch | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ steps.extract_branch.outputs.branch }} | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: "21" | ||
|
||
- name: Build API | ||
run: mvn package -Dchangelist=-rc --no-transfer-progress | ||
|
||
- name: Upload API jar | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: app-jar | ||
path: target/*.jar | ||
|
||
create-release-candidate: | ||
needs: [ check-version, build-sources ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Get previous tag | ||
id: previousTag | ||
run: echo "previousTag=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+\-rc' | tail -1)" >> $GITHUB_OUTPUT | ||
|
||
- name: Create release note | ||
id: changelog | ||
uses: requarks/changelog-action@v1 | ||
with: | ||
fromTag: ${{ github.sha }} | ||
toTag: ${{ steps.previousTag.outputs.previousTag}} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
writeToFile: false | ||
|
||
- uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ needs.check-version.outputs.release-version }} | ||
target_commitish: ${{ github.head_ref || github.ref }} | ||
name: ${{ needs.check-version.outputs.release-version }} | ||
body: ${{steps.changelog.outputs.changes}} | ||
prerelease: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
docker: | ||
needs: [ check-version, build-sources ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download uploaded jar | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: app-jar | ||
path: target/ | ||
|
||
- name: Publish to Docker Hub | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: inseefr/pearl-jam-back-office | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
default_branch: ${{ github.ref }} | ||
tags: ${{ needs.check-version.outputs.release-version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,66 +3,116 @@ name: Release & Docker | |
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- '*' | ||
|
||
- main | ||
jobs: | ||
build: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-version: ${{ steps.version-step.outputs.version }} | ||
steps: | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get source version | ||
id: version-step | ||
run: echo "version=$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | ||
|
||
- name: Print source version | ||
run: echo ${{ steps.version-step.outputs.version }} | ||
|
||
- uses: mukunku/[email protected] | ||
name: Check tag existence | ||
id: check-tag-exists | ||
with: | ||
tag: ${{ steps.version-step.outputs.version }} | ||
|
||
- name: Tag verification | ||
id: check-tag | ||
run: | | ||
if [[ "${{ steps.check-tag-exists.outputs.exists }}" == "true" ]]; then | ||
echo "Nothing to tag/release, the tag ${{ steps.version-step.outputs.version }} already exists" | ||
exit 1 | ||
fi | ||
if ! [[ "${{ steps.version-step.outputs.version }}" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then | ||
echo "Nothing to tag/release, the tag ${{ steps.version-step.outputs.version }} is not in correct format X.Y.Z" | ||
exit 1 | ||
fi | ||
build-sources: | ||
needs: check-version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: "21" | ||
- name: Build with Maven | ||
run: mvn install --file pom.xml --batch-mode --no-transfer-progress | ||
- name: Upload jar | ||
distribution: 'temurin' | ||
java-version: '21' | ||
|
||
- uses: actions/checkout@v4 | ||
- name: Build app | ||
run: mvn package --no-transfer-progress | ||
|
||
- name: Upload app jar | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: app-jar | ||
path: target/ | ||
release: | ||
path: target/*.jar | ||
|
||
create-release: | ||
needs: [ check-version, build-sources ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout current branch | ||
uses: actions/checkout@v4 | ||
- name: Get current version | ||
id: version | ||
run: echo "::set-output name=prop::$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" | ||
- run: echo ${{steps.version.outputs.prop}} | ||
- name: Release snapshot | ||
id: release-snapshot | ||
uses: actions/create-release@latest | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Get previous final release tag | ||
id: previousTag | ||
run: echo "previousTag=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$" | tail -1)" >> $GITHUB_OUTPUT | ||
|
||
- name: Create release note | ||
id: changelog | ||
uses: requarks/changelog-action@v1 | ||
with: | ||
fromTag: ${{ github.sha }} | ||
toTag: ${{ steps.previousTag.outputs.previousTag}} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
writeToFile: false | ||
|
||
- uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ needs.check-version.outputs.release-version }} | ||
target_commitish: ${{ github.head_ref || github.ref }} | ||
name: ${{ needs.check-version.outputs.release-version }} | ||
body: ${{steps.changelog.outputs.changes}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{steps.version.outputs.prop}} | ||
release_name: Release ${{steps.version.outputs.prop}} | ||
draft: false | ||
prerelease: false | ||
docker: | ||
needs: build | ||
|
||
docker: | ||
needs: [ check-version, build-sources ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download build | ||
id: download | ||
|
||
- name: Download uploaded jar | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: app-jar | ||
path: target/ | ||
- name: Get current version | ||
id: version | ||
run: echo "::set-output name=prop::$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" | ||
- run: echo ${{steps.version.outputs.prop}} | ||
- name: Publish to Registry | ||
|
||
- name: Publish to Docker Hub | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: inseefr/pearl-jam-back-office | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
tags: ${{steps.version.outputs.prop}} | ||
|
||
default_branch: ${{ github.ref }} | ||
tags: ${{ needs.check-version.outputs.release-version }} |
Oops, something went wrong.