update pipelines

This commit is contained in:
2024-08-30 17:47:42 +10:00
parent a68804ce78
commit d26d29b1ab
4 changed files with 78 additions and 87 deletions

View File

@@ -5,6 +5,13 @@ on:
branches:
- main
env:
NEXUS_USERNAME: 'edward'
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_PUBLIC_REPOSITORY_URL: ${{ secrets.MAVEN_PUBLIC_REPOSITORY_URL }}
SNAPSHOT_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL }}
RELEASE_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.RELEASE_DEPLOYMENT_REPOSITORY_URL }}
jobs:
build-and-publish:
runs-on: ubuntu-latest
@@ -18,45 +25,55 @@ jobs:
with:
fetch-depth: 0
- uses: actions/setup-java@v4.2.2
if: ${{ hashFiles('**/pom.xml') }}
with:
distribution: zulu
java-version: 17
distribution: zulu
cache: 'maven'
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v22
with:
profiles: >
[{
"id": "homelab",
"properties": {
"altSnapshotDeploymentRepository": "nexus-snapshot::${env.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL}",
"altReleaseDeploymentRepository": "nexus-release::${env.RELEASE_DEPLOYMENT_REPOSITORY_URL}"
}
}]
repositories: >
[{
"id": "maven-public",
"url": "${env.MAVEN_PUBLIC_REPOSITORY_URL}",
"snapshots": {
"enabled": "true"
}
}]
servers: >
[{
"id": "nexus-snapshot",
"username": "${env.NEXUS_USERNAME}",
"password": "${env.NEXUS_PASSWORD}"
},
{
"id": "nexus-release",
"username": "${env.NEXUS_USERNAME}",
"password": "${env.NEXUS_PASSWORD}"
}]
- name: Config Git
run: |
git config --global user.email "edward@cheng.sydney"
git config --global user.name "3dwardch3ng"
git config --global core.autocrlf input
- name: Start release
env:
NEXUS_USERNAME: 'edward'
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
SNAPSHOT_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL }}
RELEASE_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.RELEASE_DEPLOYMENT_REPOSITORY_URL }}
run: |
mvn gitflow:release-start -B -DpushRemote=true -DallowSnapshots=true \
-P homelab \
--settings=${{ github.workspace }}/.mvn/settings.xml
mvn gitflow:release-start -B -DpushRemote=true -DallowSnapshots=true -P homelab
- name: Maven Publish
env:
GITHUB_ACTOR: '3dwardch3ng'
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NEXUS_USERNAME: 'edward'
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
SNAPSHOT_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL }}
RELEASE_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.RELEASE_DEPLOYMENT_REPOSITORY_URL }}
run: |
mvn -B deploy \
-P homelab \
--settings=${{ github.workspace }}/.mvn/settings.xml
mvn -B deploy -P homelab
- name: Finish release
env:
GITHUB_ACTOR: 3dwardch3ng
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NEXUS_USERNAME: 'edward'
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
SNAPSHOT_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL }}
RELEASE_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.RELEASE_DEPLOYMENT_REPOSITORY_URL }}
run: |
mvn gitflow:release-finish -B -DpushRemote=true -DallowSnapshots=true \
-P homelab \
--settings=${{ github.workspace }}/.mvn/settings.xml
mvn gitflow:release-finish -B -DpushRemote=true -DallowSnapshots=true -P homelab

View File

@@ -18,16 +18,47 @@ jobs:
with:
fetch-depth: 0
- uses: actions/setup-java@v4.2.2
if: ${{ hashFiles('**/pom.xml') }}
with:
distribution: zulu
java-version: 17
distribution: zulu
cache: 'maven'
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v22
with:
profiles: >
[{
"id": "homelab",
"properties": {
"altSnapshotDeploymentRepository": "nexus-snapshot::${env.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL}",
"altReleaseDeploymentRepository": "nexus-release::${env.RELEASE_DEPLOYMENT_REPOSITORY_URL}"
}
}]
repositories: >
[{
"id": "maven-public",
"url": "${env.MAVEN_PUBLIC_REPOSITORY_URL}",
"snapshots": {
"enabled": "true"
}
}]
servers: >
[{
"id": "nexus-snapshot",
"username": "${env.NEXUS_USERNAME}",
"password": "${env.NEXUS_PASSWORD}"
},
{
"id": "nexus-release",
"username": "${env.NEXUS_USERNAME}",
"password": "${env.NEXUS_PASSWORD}"
}]
- name: Maven Publish
env:
NEXUS_USERNAME: 'edward'
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_PUBLIC_REPOSITORY_URL: ${{ secrets.MAVEN_PUBLIC_REPOSITORY_URL }}
SNAPSHOT_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL }}
RELEASE_DEPLOYMENT_REPOSITORY_URL: ${{ secrets.RELEASE_DEPLOYMENT_REPOSITORY_URL }}
run: |
mvn -B deploy \
-P homelab \
--settings=${{ github.workspace }}/.mvn/settings.xml
mvn -B deploy -P homelab

View File

@@ -1,53 +0,0 @@
<settings>
<profiles>
<profile>
<id>homelab</id>
<properties>
<altSnapshotDeploymentRepository>nexus-snapshot::${env.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL}</altSnapshotDeploymentRepository>
<altReleaseDeploymentRepository>nexus-release::${env.RELEASE_DEPLOYMENT_REPOSITORY_URL}</altReleaseDeploymentRepository>
</properties>
<repositories>
<repository>
<id>nexus-snapshot</id>
<name>Home Lab Nexus Snapshot</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>${env.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL}</url>
<layout>default</layout>
</repository>
<repository>
<id>nexus-release</id>
<name>Home Lab Nexus Release</name>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>${env.RELEASE_DEPLOYMENT_REPOSITORY_URL}</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>nexus-snapshot</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
<server>
<id>nexus-release</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
</servers>
</settings>

View File

@@ -256,10 +256,6 @@
</commitMessages>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>