Skip to content

Commit e6d0818

Browse files
committed
ci: Add initial workflows
1 parent 3df0673 commit e6d0818

5 files changed

Lines changed: 163 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "JDK Setup"
2+
runs:
3+
using: "composite"
4+
steps:
5+
- name: Set up JDK 21
6+
uses: actions/setup-java@v5
7+
with:
8+
java-version: '21'
9+
distribution: 'temurin'
10+
cache: maven

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
8+
- package-ecosystem: maven
9+
directory: /
10+
schedule:
11+
interval: weekly
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build any branch
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'src/site/**'
7+
- '**/*.adoc'
8+
- '**/*.md'
9+
pull_request:
10+
paths-ignore:
11+
- 'src/site/**'
12+
- '**/*.adoc'
13+
- '**/*.md'
14+
15+
env:
16+
MAVEN_COMMAND: ./mvnw
17+
MAVEN_CLI_COMMON: "-e -B"
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 15
27+
permissions:
28+
contents: write
29+
steps:
30+
- uses: actions/checkout@v6
31+
- uses: ./.github/actions/jdk-setup
32+
- name: Build and verify
33+
run: ${{ env.MAVEN_COMMAND }} ${{ env.MAVEN_CLI_COMMON }} clean verify
34+
- name: Submit dependencies to GitHub
35+
if: github.actor != 'dependabot[bot]'
36+
uses: advanced-security/maven-dependency-submission-action@v5
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy Snapshot
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build any branch"]
6+
types: [completed]
7+
branches: [main]
8+
9+
env:
10+
MAVEN_COMMAND: ./mvnw
11+
MAVEN_CLI_COMMON: "-e -B"
12+
13+
jobs:
14+
deploy-snapshot:
15+
if: github.event.workflow_run.conclusion == 'success'
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
steps:
19+
- uses: actions/checkout@v6
20+
- uses: ./.github/actions/jdk-setup
21+
- uses: actions/setup-java@v5
22+
with:
23+
java-version: '21'
24+
distribution: 'temurin'
25+
server-id: central-publish
26+
server-username: CENTRAL_USERNAME
27+
server-password: CENTRAL_TOKEN
28+
29+
- name: Get project version
30+
id: ver
31+
run: echo "version=$(${{ env.MAVEN_COMMAND }} help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
32+
33+
- name: Deploy snapshot to Maven Central
34+
if: endsWith(steps.ver.outputs.version, '-SNAPSHOT')
35+
env:
36+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
37+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
38+
run: ${{ env.MAVEN_COMMAND }} ${{ env.MAVEN_CLI_COMMON }} deploy -DskipTests
39+
40+
- name: Skip (not a snapshot version)
41+
if: "!endsWith(steps.ver.outputs.version, '-SNAPSHOT')"
42+
run: echo "Version ${{ steps.ver.outputs.version }} is a release version — skipping snapshot deploy"

.github/workflows/publish-docs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and Deploy Maven Site to GitHub Pages
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'src/site/**'
9+
- '**/*.adoc'
10+
- '**/*.md'
11+
workflow_run:
12+
workflows: ["Build any branch"]
13+
types: [completed]
14+
branches: [main]
15+
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
concurrency:
22+
group: pages
23+
cancel-in-progress: false
24+
25+
env:
26+
MAVEN_COMMAND: ./mvnw
27+
MAVEN_CLI_COMMON: "-e -B"
28+
29+
jobs:
30+
build-site:
31+
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 20
34+
steps:
35+
- uses: actions/checkout@v6
36+
- uses: ./.github/actions/jdk-setup
37+
- name: Build project
38+
run: ${{ env.MAVEN_COMMAND }} ${{ env.MAVEN_CLI_COMMON }} install -DskipTests
39+
- name: Generate Maven site
40+
run: ${{ env.MAVEN_COMMAND }} ${{ env.MAVEN_CLI_COMMON }} site -Dproject.build.outputTimestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
41+
- name: Upload Pages artifact
42+
if: >-
43+
github.event_name == 'workflow_dispatch' ||
44+
github.event_name == 'push' ||
45+
github.event_name == 'workflow_run'
46+
uses: actions/upload-pages-artifact@v5
47+
with:
48+
path: target/site/
49+
50+
deploy:
51+
needs: build-site
52+
if: >-
53+
github.event_name == 'workflow_dispatch' ||
54+
github.event_name == 'push' ||
55+
github.event_name == 'workflow_run'
56+
runs-on: ubuntu-latest
57+
timeout-minutes: 10
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v5

0 commit comments

Comments
 (0)