Skip to content

Commit 7c6e569

Browse files
committed
ops: add github deployment
1 parent e306830 commit 7c6e569

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

.github/workflows/build.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CoreAPI | Build and deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
description: 'The version of the new build.'
8+
required: true
9+
type: string
10+
isRelease:
11+
description: 'Is this a release build?'
12+
required: true
13+
type: boolean
14+
15+
permissions:
16+
contents: write
17+
packages: write
18+
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up to JDK 1.8
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'temurin'
32+
cache: 'maven'
33+
java-version: 21
34+
35+
- name: Set Project Version
36+
run: mvn versions:set -DnewVersion=${{ inputs.version }}
37+
38+
- name: Build with Maven
39+
run: mvn -B clean package
40+
41+
- name: Deploy to GitHub Packages # Repository is set in pom.xml
42+
run: mvn deploy
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Upload assets to release
47+
if: ${{ inputs.isRelease }}
48+
uses: softprops/[email protected]
49+
with:
50+
files: |
51+
target/api-${{ inputs.version }}.jar
52+
target/api-${{ inputs.version }}-sources.jar
53+
target/api-${{ inputs.version }}-javadoc.jar

.github/workflows/nightly-build.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CoreAPI | Nightly Builder
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
get-latest-version:
12+
name: Get latest version
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.version-ready.outputs.release }}
16+
steps:
17+
- name: Get latest release version
18+
if: github.event_name == 'push'
19+
id: get-latest-version
20+
uses: pozetroninc/[email protected]
21+
with:
22+
repository: ${{ github.repository }}
23+
24+
- name: Increment version
25+
if: github.event_name == 'push'
26+
id: increment-version
27+
run: |
28+
RELEASE_NAME=${{ steps.get-latest-version.outputs.release }}
29+
echo "release=$(echo ${RELEASE_NAME#v} | awk -F. -v OFS=. '{$NF = $NF + 1;} 1')" >> "$GITHUB_OUTPUT"
30+
31+
- name: Set output
32+
id: version-ready
33+
34+
run: |
35+
if [[ "${{ github.ref_name}}" == "main" || "${{ github.ref_name }}" == "master" ]]; then
36+
echo "release=${{ steps.increment-version.outputs.release }}" >> "$GITHUB_OUTPUT"
37+
else
38+
echo "release=${{ github.ref_name }}_${{ steps.increment-version.outputs.release }}" >> "$GITHUB_OUTPUT"
39+
fi
40+
41+
build-nightly:
42+
name: Build Nightly version
43+
needs: get-latest-version
44+
uses: ./.github/workflows/build.yml
45+
with:
46+
version: ${{ needs.get-latest-version.outputs.version }}-SNAPSHOT
47+
isRelease: false

.github/workflows/release-build.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CoreAPI | Release Builder
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
get-version:
9+
name: Get Version
10+
runs-on: ubuntu-latest
11+
outputs:
12+
version: ${{ steps.get-version.outputs.version }}
13+
steps:
14+
- name: Get Version
15+
id: get-version
16+
run: |
17+
TAG_NAME=${{ github.event.release.tag_name }}
18+
echo "version=${TAG_NAME#v}" >> "$GITHUB_OUTPUT"
19+
20+
build-release:
21+
name: Build Release
22+
needs: get-version
23+
uses: ./.github/workflows/build.yml
24+
with:
25+
version: ${{ needs.get-version.outputs.version }}
26+
isRelease: true

0 commit comments

Comments
 (0)