From 45cd52113963d8d9fb6f4330325cbf3b14f482c1 Mon Sep 17 00:00:00 2001 From: Julien GALET Date: Thu, 29 Apr 2021 10:36:08 +0200 Subject: [PATCH] feat: configure snapshot deployment --- .../maven-github-packages-deploy-release.yaml | 27 +++++++++++++++++++ .../maven-github-packages-deploy.yaml | 12 ++++----- pom.xml | 21 ++++++++++++--- settings.xml | 7 ++++- 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/maven-github-packages-deploy-release.yaml diff --git a/.github/workflows/maven-github-packages-deploy-release.yaml b/.github/workflows/maven-github-packages-deploy-release.yaml new file mode 100644 index 0000000..69cf37d --- /dev/null +++ b/.github/workflows/maven-github-packages-deploy-release.yaml @@ -0,0 +1,27 @@ +name: Java GitHub CD with Maven + +on: + push: + branches: [ master ] +jobs: + build: + name: Deploy Release + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[maven-release-plugin]')" + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + server-id: github-release # Value of the distributionManagement/repository/id field of the pom.xml + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn --file pom.xml -s settings.xml release:clean release:prepare release:perform -Dusername=${USERNAME} -Dpassword=${PASSWORD} -Darguments="-Denv.USERNAME=${USERNAME} -Denv.PASSWORD=${PASSWORD} -Dmaven.test.skip=true -DaltDeploymentRepository=github-release::default::https://maven.pkg.github.com/juliengalet/reactor-flow" + env: + USERNAME: ${{github.actor}} + PASSWORD: ${{github.token}} \ No newline at end of file diff --git a/.github/workflows/maven-github-packages-deploy.yaml b/.github/workflows/maven-github-packages-deploy.yaml index f981dfe..750284f 100644 --- a/.github/workflows/maven-github-packages-deploy.yaml +++ b/.github/workflows/maven-github-packages-deploy.yaml @@ -1,10 +1,11 @@ name: Java GitHub CD with Maven on: - release: - types: [ created ] + pull_request: + types: [ opened, synchronize, reopened ] jobs: build: + name: Deploy Snapshot runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -13,14 +14,13 @@ jobs: with: java-version: '11' distribution: 'adopt' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file + server-id: github-snapshot # Value of the distributionManagement/repository/id field of the pom.xml - name: Build with Maven run: mvn -B package --file pom.xml - name: Publish to GitHub Packages Apache Maven - run: mvn deploy --file pom.xml -s settings.xml + run: mvn deploy --file pom.xml -s settings.xml -Denv.USERNAME=${USERNAME} -Denv.PASSWORD=${PASSWORD} -Dmaven.test.skip=true -DaltDeploymentRepository=github-snapshot::default::https://maven.pkg.github.com/juliengalet/reactor-flow env: - USENAME: ${{github.actor}} + USERNAME: ${{github.actor}} PASSWORD: ${{github.token}} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1b04d38..8b823f2 100644 --- a/pom.xml +++ b/pom.xml @@ -22,13 +22,15 @@ github-snapshot - GitHub Packages + GitHub snapshot https://maven.pkg.github.com/juliengalet/reactor-flow + true - github - GitHub Packages + github-release + GitHub release https://maven.pkg.github.com/juliengalet/reactor-flow + false @@ -68,6 +70,7 @@ 3.2.0 3.7.1 3.1.1 + 2.5.3 juliengalet_reactor-flow juliengalet https://sonarcloud.io @@ -114,6 +117,18 @@ src/main/java + + + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + + v@{project.version} + + + + org.apache.maven.plugins diff --git a/settings.xml b/settings.xml index cd7e943..98619df 100644 --- a/settings.xml +++ b/settings.xml @@ -1,7 +1,12 @@ - github + github-snapshot + ${env.USERNAME} + ${env.PASSWORD} + + + github-release ${env.USERNAME} ${env.PASSWORD}