Skip to content

Commit

Permalink
feat(prepare-release): allow to prepare next release and publish snap…
Browse files Browse the repository at this point in the history
…shot
  • Loading branch information
THOREL Arnaud authored and THOREL Arnaud committed Nov 28, 2023
1 parent 393a9e4 commit 58d939a
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 64 deletions.
9 changes: 0 additions & 9 deletions .github/deploy_settings.xml

This file was deleted.

35 changes: 16 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build

on:
Expand All @@ -18,25 +10,30 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Code Coverage
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build
run: mvn -ntp -B package --file pom.xml
- name: Coverage
uses: codecov/codecov-action@v3
with:
name: ${{ github.event.repository.name }}
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Sonar
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_PROJECT: Ouest-France_${{ github.event.repository.name }}
run: |
echo "run sonar on " ${GITHUB_REF##*/} " for project key : " $SONAR_PROJECT " and organization " ${{ vars.SONAR_ORGANIZATION }}
mvn -B package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} -Dsonar.projectKey=$SONAR_PROJECT -Dsonar.branch.name=${GITHUB_REF##*/}
run: mvn -ntp -B sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} -Dsonar.projectKey=$SONAR_PROJECT -Dsonar.branch.name=${GITHUB_REF##*/}
- name: Deploy Snapshot
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: mvn -ntp -B deploy -DskipTests=true
35 changes: 0 additions & 35 deletions .github/workflows/maven-publish.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions'
git config --global user.email 'actions[bot]@github.com'
mvn -ntp -B release:prepare release:perform -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} -Dtag=temp_$${{ github.event.inputs.releaseVersion }}
- name: Post-Release
run: git push --delete origin temp_$${{ github.event.inputs.releaseVersion }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,6 @@ The QueryDSL is licensed under [MIT License](https://opensource.org/license/mit/
[coverage-image]: https://codecov.io/gh/ouest-france/querydsl/graph/badge.svg?token=ZLEG2TBML8
[coverage-url]: https://codecov.io/gh/ouest-france/querydsl
[maven-central-image]: https://maven-badges.herokuapp.com/maven-central/fr.ouestfrance.querydsl/querydsl/badge.svg
[maven-central-url]: http://search.maven.org/#search%7Cga%7C1%7Cfr.ouestfrance.querydsl
[maven-central-url]: https://mvnrepository.com/artifact/fr.ouestfrance.querydsl/querydsl
[sonar-image]: https://sonarcloud.io/api/project_badges/measure?project=Ouest-France_querydsl&metric=alert_status
[sonar-url]: https://sonarcloud.io/summary/new_code?id=Ouest-France_querydsl
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@
<artifactId>maven-release-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<scmCommentPrefix>[ci skip]</scmCommentPrefix>
<arguments>-Dmaven.test.skipTests=true -Dmaven.test.skip=true</arguments>
</configuration>
</plugin>
<plugin>
Expand Down

0 comments on commit 58d939a

Please sign in to comment.