Skip to content

Commit 08abfed

Browse files
committed
add a new Github Action workflow when releasing the plugin
1 parent e74d82f commit 08abfed

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

.github/workflows/build.yml renamed to .github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: compile-and-test
22

33
on:
44
pull_request:
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/setup-java@v4
1414
with:
1515
distribution: 'temurin'
16-
java-version: 17
16+
java-version: 21
1717
- name: Setup Gradle
1818
uses: gradle/actions/setup-gradle@v4
1919
- name: Build with Gradle

.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: pathhierarchy-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/pathhierarchy-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)