Skip to content

Commit

Permalink
feat: configure snapshot deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
juliengalet committed Apr 29, 2021
1 parent 6c753c3 commit 45cd521
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 10 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/maven-github-packages-deploy-release.yaml
Original file line number Diff line number Diff line change
@@ -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}}
12 changes: 6 additions & 6 deletions .github/workflows/maven-github-packages-deploy.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}}
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
<distributionManagement>
<snapshotRepository>
<id>github-snapshot</id>
<name>GitHub Packages</name>
<name>GitHub snapshot</name>
<url>https://maven.pkg.github.com/juliengalet/reactor-flow</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<id>github-release</id>
<name>GitHub release</name>
<url>https://maven.pkg.github.com/juliengalet/reactor-flow</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -68,6 +70,7 @@
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-site-plugin.version>3.7.1</maven-site-plugin.version>
<maven-project-info-reports-plugin.version>3.1.1</maven-project-info-reports-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<sonar.projectKey>juliengalet_reactor-flow</sonar.projectKey>
<sonar.organization>juliengalet</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down Expand Up @@ -114,6 +117,18 @@

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
7 changes: 6 additions & 1 deletion settings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>github</id>
<id>github-snapshot</id>
<username>${env.USERNAME}</username>
<password>${env.PASSWORD}</password>
</server>
<server>
<id>github-release</id>
<username>${env.USERNAME}</username>
<password>${env.PASSWORD}</password>
</server>
Expand Down

0 comments on commit 45cd521

Please sign in to comment.