Adding github action pipelines
This commit is contained in:
66
.github/workflows/build-and-publish-develop.yaml
vendored
Normal file
66
.github/workflows/build-and-publish-develop.yaml
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
name: SNAPSHOT - Build and Publish Maven Artifacts
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
|
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-java:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
name: Build Java Package and Publish
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-java@v4.2.2
|
||||||
|
if: ${{ hashFiles('**/pom.xml') }}
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
run: |
|
||||||
|
mvn -B deploy -P homelab
|
||||||
80
.github/workflows/build-and-publish-release.yml
vendored
Normal file
80
.github/workflows/build-and-publish-release.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
name: RELEASE - Build and Publish Maven Artifacts
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
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-java:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
name: Build Java Package and Publish
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-java@v4.2.2
|
||||||
|
if: ${{ hashFiles('**/pom.xml') }}
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
run: |
|
||||||
|
mvn gitflow:release-start -B -DpushRemote=true -DallowSnapshots=true -P homelab
|
||||||
|
- name: Maven Publish
|
||||||
|
run: |
|
||||||
|
mvn -B deploy -P homelab
|
||||||
|
- name: Finish release
|
||||||
|
env:
|
||||||
|
GITHUB_ACTOR: 3dwardch3ng
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
run: |
|
||||||
|
mvn gitflow:release-finish -B -DpushRemote=true -DallowSnapshots=true -P homelab
|
||||||
26
pom.xml
26
pom.xml
@@ -39,10 +39,10 @@
|
|||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>database</module>
|
|
||||||
<module>swagger</module>
|
<module>swagger</module>
|
||||||
<module>configuration</module>
|
|
||||||
<module>entity</module>
|
<module>entity</module>
|
||||||
|
<module>configuration</module>
|
||||||
|
<module>database</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -64,6 +64,28 @@
|
|||||||
<sonar.host.url>https://sonarqube.cluster.edward.sydney</sonar.host.url>
|
<sonar.host.url>https://sonarqube.cluster.edward.sydney</sonar.host.url>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>${maven-source-plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user