build(deps-dev): bump net.masterthought:cucumber-reporting #61
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
name: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
verify-version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
- name: Test snapshot | |
run: if [[ "${{ steps.get_version.outputs.VERSION }}" == *"-SNAPSHOT" ]]; then exit 1; else exit 0; fi | |
- name: Get release | |
id: get_release | |
run: echo ::set-output name=RELEASE_HTTP_CODE::$(curl -s -o out.html -w '%{http_code}' https://github.com/les-projets-cagnottes/core/releases/tag/${{ steps.get_version.outputs.VERSION }};) | |
- name: Test release existence | |
run: if [[ "${{ steps.get_release.outputs.RELEASE_HTTP_CODE }}" -eq "200" ]]; then exit 1; else exit 0; fi | |
build: | |
needs: verify-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build with Maven | |
run: ./mvnw -B clean spring-boot:build-image --file pom.xml | |
cucumber: | |
needs: [verify-version, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Test with Maven | |
id: tests_run | |
run: echo ::set-output name=EXIT_CODE::$(./mvnw -B clean test --file pom.xml > test.log ; echo $?) | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
- name: Generate Cluecumber report | |
run: ./mvnw -B cluecumber-report:reporting --file pom-cluecumber.xml | |
- name: Checkout private tools | |
uses: actions/checkout@v4 | |
with: | |
repository: les-projets-cagnottes/les-projets-cagnottes.github.io | |
token: ${{ secrets.PUSH_CUCUMBER_REPORTS_GITHUB_TOKEN }} | |
path: les-projets-cagnottes.github.io | |
- name: Clean previous version | |
run: rm -rf les-projets-cagnottes.github.io/cucumber/${{ steps.get_version.outputs.VERSION }} | |
- name: Prepare Cucumber output directory | |
run: mkdir -p les-projets-cagnottes.github.io/cucumber/${{ steps.get_version.outputs.VERSION }} | |
- name: Copy Cucumber Report | |
run: cp -r target/cluecumber/* les-projets-cagnottes.github.io/cucumber/${{ steps.get_version.outputs.VERSION }}/ | |
- name: Copy Cucumber Report | |
run: cp -r target/cluecumber/* les-projets-cagnottes.github.io/cucumber/master/ | |
- name: Publish https://les-projets-cagnottes.github.io/cucumber/${{ steps.get_version.outputs.VERSION }} | |
run: | | |
cd les-projets-cagnottes.github.io | |
git config user.email "${{ secrets.GIT_CONFIG_EMAIL }}" && git config user.name "${{ secrets.GIT_CONFIG_NAME }}" | |
git status | |
git add . | |
git commit --allow-empty -m "Update Cucumber for version '${{ steps.get_version.outputs.VERSION }}'" | |
git push | |
exit ${{ steps.tests_run.outputs.EXIT_CODE }} | |
release: | |
needs: [verify-version, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Config Git | |
run: git config user.email "${{ secrets.GIT_CONFIG_EMAIL }}" && git config user.name "${{ secrets.GIT_CONFIG_NAME }}" | |
- run: git tag ${{ needs.verify-version.outputs.version }} | |
- run: git push origin ${{ needs.verify-version.outputs.version }} | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.verify-version.outputs.version }} | |
release_name: ${{ needs.verify-version.outputs.version }} | |
draft: false | |
prerelease: false | |
publish-docker: | |
needs: [verify-version, release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ needs.verify-version.outputs.version }}' | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build with Maven | |
run: ./mvnw -B clean spring-boot:build-image --file pom.xml | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
- name: Tag the version image for Docker Hub | |
run: docker tag core:${{ steps.get_version.outputs.VERSION }} lesprojetscagnottes/api:${{ steps.get_version.outputs.VERSION }} | |
- name: Tag the latest image for Docker Hub | |
run: docker tag core:${{ steps.get_version.outputs.VERSION }} lesprojetscagnottes/api:latest | |
- name: Login to Docker Hub | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Publish latest to Docker Hub | |
run: docker push lesprojetscagnottes/api:latest | |
- name: Publish version to Docker Hub | |
run: docker push lesprojetscagnottes/api:${{ steps.get_version.outputs.VERSION }} |