Skip to content

Commit 9c7a504

Browse files
committed
Add GitHub Actions CI/CD workflows
1 parent a49ae54 commit 9c7a504

2 files changed

Lines changed: 159 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- '[0-9]+.[0-9]+.x'
8+
pull_request:
9+
branches:
10+
- master
11+
- '[0-9]+.[0-9]+.x'
12+
schedule:
13+
- cron: '0 18 * * *'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
MAVEN_OPTS: '-Xmx4G -Xms1G -Djava.security.egd=file:/dev/./urandom'
21+
MAVEN_CLI_OPTS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
22+
23+
jobs:
24+
incremental-build:
25+
if: github.event_name == 'pull_request'
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 30
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Set up JDK 17
35+
uses: actions/setup-java@v4
36+
with:
37+
java-version: '17'
38+
distribution: 'temurin'
39+
cache: maven
40+
41+
- name: Build
42+
run: mvn clean install $MAVEN_CLI_OPTS
43+
44+
full-build:
45+
if: github.event_name != 'pull_request'
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 30
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Set up JDK 17
53+
uses: actions/setup-java@v4
54+
with:
55+
java-version: '17'
56+
distribution: 'temurin'
57+
cache: maven
58+
59+
- name: Build
60+
run: mvn clean install $MAVEN_CLI_OPTS
61+
62+
deploy:
63+
needs: full-build
64+
if: |
65+
github.event_name != 'pull_request' &&
66+
(github.ref == 'refs/heads/master' || contains(github.ref, '.x'))
67+
runs-on: ubuntu-latest
68+
environment: production
69+
permissions:
70+
packages: write
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
75+
- name: Set up JDK 17
76+
uses: actions/setup-java@v4
77+
with:
78+
java-version: '17'
79+
distribution: 'temurin'
80+
cache: maven
81+
82+
- name: Configure Maven settings
83+
uses: s4u/maven-settings-action@v3.0.0
84+
with:
85+
servers: |
86+
[{
87+
"id": "releases",
88+
"username": "${{ github.actor }}",
89+
"password": "${{ secrets.GITHUB_TOKEN }}"
90+
},
91+
{
92+
"id": "snapshots",
93+
"username": "${{ github.actor }}",
94+
"password": "${{ secrets.GITHUB_TOKEN }}"
95+
}]
96+
97+
- name: Deploy
98+
run: |
99+
mvn deploy $MAVEN_CLI_OPTS \
100+
-DskipTests=true \
101+
-DretryFailedDeploymentCount=10 \
102+
-Dreleases.repository.url=https://maven.pkg.github.com/codice/ddf-support \
103+
-Dsnapshots.repository.url=https://maven.pkg.github.com/codice/ddf-support

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: 'Branch to release'
7+
required: true
8+
default: 'master'
9+
releaseType:
10+
description: 'Release type'
11+
required: true
12+
default: 'Build'
13+
type: choice
14+
options: [Build, Release, RC1, RC2, RC3]
15+
nextDevVersion:
16+
description: 'Next dev version (blank = auto)'
17+
required: false
18+
notesUrl:
19+
description: 'Release notes URL'
20+
required: false
21+
skipTests:
22+
description: 'Skip tests'
23+
default: true
24+
type: boolean
25+
testRun:
26+
description: 'Test run only'
27+
default: false
28+
type: boolean
29+
resumeFrom:
30+
description: 'Resume failed deploy from module. Leave blank for normal release.'
31+
required: false
32+
33+
permissions:
34+
contents: read
35+
packages: write
36+
37+
jobs:
38+
release:
39+
uses: codice/release-pipelines/.github/workflows/maven-release.yml@main
40+
with:
41+
app_name: 'ddf-support'
42+
branch: ${{ inputs.branch }}
43+
release_type: ${{ inputs.releaseType }}
44+
next_dev_version: ${{ inputs.nextDevVersion }}
45+
skip_tests: ${{ inputs.skipTests }}
46+
test_run: ${{ inputs.testRun }}
47+
jdk_version_map: '{"master":"17","default":"17"}'
48+
artifact_path: 'target'
49+
resume_from: ${{ inputs.resumeFrom }}
50+
author_name: 'Codice Release Manager'
51+
author_email: 'info@codicefoundation.org'
52+
secrets:
53+
app_id: ${{ secrets.RELEASE_APP_ID }}
54+
app_private_key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
55+
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
56+
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

0 commit comments

Comments
 (0)