Skip to content

Commit 029cda8

Browse files
committed
add a new Github Actions workflow dedicated to the releases
1 parent bd6bf50 commit 029cda8

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/release.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: build-and-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+
container:
13+
image: gradle:8-jdk21
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Tag Version Name Extraction
19+
id: version
20+
shell: bash
21+
run: |
22+
if [[ -n "${{ github.event.release.tag_name }}" ]]; then
23+
# Relase Github
24+
TAG_NAME="${{ github.event.release.tag_name }}"
25+
echo "📋 Triggered by GitHub release: $TAG_NAME"
26+
else
27+
# Just a new tag
28+
TAG_NAME=${GITHUB_REF#refs/tags/}
29+
echo "🏷️ Triggered by Git tag: $TAG_NAME"
30+
fi
31+
32+
# Get rid of the 'v', e.g. v8.18.1.0 -> 8.18.1.0
33+
VERSION=${TAG_NAME#v}
34+
echo "version=$VERSION" >> $GITHUB_OUTPUT
35+
36+
37+
- name: Java Compilation
38+
run: ./gradlew -Pplugin_version=${{ steps.version.outputs.version }} clean assemble --no-daemon
39+
40+
- name: Upload Plugin Artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: elasticsearch-plugin-geoshape-${{ steps.version.outputs.version }}
44+
path: build/distributions/*.zip
45+
46+
- name: Attach ZIP to GitHub Release
47+
uses: softprops/action-gh-release@v2
48+
if: github.event.release.tag_name != ''
49+
with:
50+
files: build/distributions/elasticsearch-plugin-geoshape-${{ steps.version.outputs.version }}.zip
51+
tag_name: ${{ github.event.release.tag_name }}
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)