Skip to content

Commit ab4c9fa

Browse files
committed
add two new Github Actions to build and release
1 parent 3c44621 commit ab4c9fa

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

.github/workflows/build.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: compile-and-test
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout sources
11+
uses: actions/checkout@v4
12+
- name: Setup Java
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin'
16+
java-version: 21
17+
- name: Setup Gradle
18+
uses: gradle/actions/setup-gradle@v4
19+
- name: Check Format
20+
run: ./gradlew spotlessCheck
21+
- name: Compile
22+
run: ./gradlew assemble
23+
- name: Run Tests
24+
run: ./gradlew check

.github/workflows/release.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
build-artifact:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Tag Version Name Extraction
17+
id: version
18+
shell: bash
19+
run: |
20+
if [[ -n "${{ github.event.release.tag_name }}" ]]; then
21+
# Relase Github
22+
TAG_NAME="${{ github.event.release.tag_name }}"
23+
echo "📋 Triggered by GitHub release: $TAG_NAME"
24+
else
25+
# Just a new tag
26+
TAG_NAME=${GITHUB_REF#refs/tags/}
27+
echo "🏷️ Triggered by Git tag: $TAG_NAME"
28+
fi
29+
30+
# Get rid of the 'v', e.g. v8.18.1.0 -> 8.18.1.0
31+
VERSION=${TAG_NAME#v}
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
33+
34+
- name: Setup Java
35+
uses: actions/setup-java@v4
36+
with:
37+
distribution: 'temurin'
38+
java-version: 21
39+
40+
- name: Setup Gradle
41+
uses: gradle/actions/setup-gradle@v4
42+
43+
- name: Java Compilation
44+
run: ./gradlew -Pplugin_version=${{ steps.version.outputs.version }} clean assemble --no-daemon
45+
46+
- name: Upload Plugin Artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: geopoint-clustering-aggregation-${{ steps.version.outputs.version }}
50+
path: build/distributions/*.zip
51+
52+
- name: Attach ZIP to GitHub Release
53+
uses: softprops/action-gh-release@v2
54+
if: github.event.release.tag_name != ''
55+
with:
56+
files: build/distributions/geopoint-clustering-aggregation-${{ steps.version.outputs.version }}.zip
57+
tag_name: ${{ github.event.release.tag_name }}
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)