Skip to content

Commit daaccbe

Browse files
committed
DevOps
1 parent 042a7f0 commit daaccbe

File tree

6 files changed

+190
-35
lines changed

6 files changed

+190
-35
lines changed

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
9+
# Maintain dependencies for Maven
10+
- package-ecosystem: "maven"
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
open-pull-requests-limit: 10
15+
16+
# Maintain dependencies for GitHub Actions
17+
- package-ecosystem: "github-actions"
18+
# Set the directory to / to check for workflow files stored in the default location of `.github/workflows`
19+
directory: "/"
20+
schedule:
21+
interval: "daily"

.github/workflows/maven.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/pages.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Maven site to GitHub Pages
2+
3+
on:
4+
workflow_dispatch: {}
5+
issues:
6+
types: [opened, edited, deleted]
7+
release: {}
8+
concurrency:
9+
group: github-pages
10+
cancel-in-progress: false
11+
permissions:
12+
contents: read
13+
issues: read
14+
pages: write
15+
id-token: write
16+
jobs:
17+
test:
18+
runs-on: ubuntu-24.04
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: 21
25+
distribution: 'temurin'
26+
cache: maven
27+
- name: Test with Maven
28+
run: mvn clean test verify --file pom.xml
29+
build:
30+
runs-on: ubuntu-24.04
31+
needs: test
32+
environment:
33+
name: github-pages
34+
url: ${{ steps.deployment.outputs.url }}
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Set up JDK 21
38+
uses: actions/setup-java@v4
39+
with:
40+
java-version: 21
41+
distribution: 'temurin'
42+
cache: maven
43+
- name: Deploy site
44+
run: mvn clean site --file pom.xml
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Setup Pages
48+
uses: actions/configure-pages@v5
49+
- name: Upload Artifacts
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: ./target/site
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Deploy Maven Release
2+
3+
on:
4+
workflow_dispatch: {}
5+
release:
6+
types: [published]
7+
concurrency:
8+
group: release
9+
permissions:
10+
contents: write
11+
packages: write
12+
id-token: write
13+
attestations: write
14+
env:
15+
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
jobs:
18+
test:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up JDK 21
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: 21
26+
distribution: 'temurin'
27+
cache: maven
28+
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
29+
- name: Test with Maven
30+
run: mvn --batch-mode test verify --file pom.xml
31+
build:
32+
runs-on: ubuntu-24.04
33+
needs: test
34+
environment:
35+
name: release
36+
url: ${{ steps.deployment.outputs.url }}
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Set up JDK 21
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: 21
43+
distribution: 'temurin'
44+
cache: maven
45+
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
46+
- name: Set GitHub Credentials
47+
run: |
48+
git config --global user.name "Coderic"
49+
git config --global user.email "[email protected]"
50+
- name: Build package
51+
run: mvn --batch-mode package --file pom.xml
52+
- name: Attest build provenance
53+
uses: actions/attest-build-provenance@v2
54+
with:
55+
subject-path: target/*.war
56+
- name: Prepare package
57+
run: mvn --batch-mode release:prepare -DtagNameFormat=@{project.version} --file pom.xml
58+
- name: Deploy package
59+
id: deployment
60+
run: mvn --batch-mode release:perform -DtagNameFormat=@{project.version} --file pom.xml
61+
deploy:
62+
runs-on: ubuntu-24.04
63+
environment:
64+
name: staging
65+
url: ${{ steps.deployment.outputs.url }}
66+
needs: build
67+
steps:
68+
- uses: actions/checkout@v4
69+
- run: sed -i 's|http://localhost:8080/|${{ secrets.TOMCAT_HOST }}|g' pom.xml
70+
- name: Set up Maven Central Repository
71+
uses: actions/setup-java@v4
72+
with:
73+
java-version: 21
74+
distribution: 'temurin'
75+
cache: maven
76+
server-id: TomcatServer
77+
server-username: MAVEN_USERNAME
78+
server-password: MAVEN_PASSWORD
79+
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
80+
- name: Deploy package
81+
run: mvn --batch-mode tomcat7:deploy --file pom.xml
82+
env:
83+
MAVEN_USERNAME: ${{ secrets.TOMCAT_USER }}
84+
MAVEN_PASSWORD: ${{ secrets.TOMCAT_PASS }}

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Java Test with Maven
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
permissions:
9+
contents: write
10+
packages: write
11+
id-token: write
12+
env:
13+
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
jobs:
16+
test:
17+
runs-on: ubuntu-24.04
18+
environment: testing
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: 21
25+
distribution: temurin
26+
cache: maven
27+
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
28+
- name: Test with Maven
29+
run: mvn clean verify --file pom.xml

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<groupId>org.coderic.springboot</groupId>
1212
<artifactId>parent</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14+
<packaging>pom</packaging>
1415
<name>Coderic Spring Boot parent</name>
1516
<description>Coderic Spring Boot parent</description>
1617
<url>https://github.com/Coderic/org.coderic.springboot.parent</url>

0 commit comments

Comments
 (0)