Skip to content

Commit 1177e98

Browse files
author
Tyler Coles
committed
GitHub Actions for CI and release management.
1 parent a921a9a commit 1177e98

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Java CI with Maven
2+
3+
on:
4+
push:
5+
branches: [ $default-branch ]
6+
pull_request:
7+
branches: [ $default-branch ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
- name: Setup JDK
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: 1.8
19+
cache: maven
20+
- name: Build with Maven
21+
run: mvn --batch-mode package

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to the Maven Central Repository
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
- name: Set up repo
14+
uses: actions/setup-java@v3
15+
with:
16+
java-version: 1.8
17+
server-id: ossrh
18+
server-username: MAVEN_USERNAME
19+
server-password: MAVEN_PASSWORD
20+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
21+
gpg-passphrase: GPG_PASSPHRASE
22+
- name: Publish package
23+
run: mvn --batch-mode deploy
24+
env:
25+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
26+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
27+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Create a draft release when pushing a version tag, e.g.: v1.4.0
2+
name: Create Release
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
- name: Create release
16+
id: create_release
17+
uses: actions/create-release@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
tag_name: ${{ github.ref }}
22+
release_name: Release ${{ github.ref }}
23+
body: |
24+
- First change
25+
- Second change
26+
draft: true
27+
prerelease: false

0 commit comments

Comments
 (0)