Skip to content

Commit

Permalink
chore: add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
yinheli committed Dec 7, 2023
1 parent 911d79c commit 24705dd
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create release and upload binaries

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]*"

workflow_dispatch:

permissions:
contents: write

jobs:
build:
name: Build release binaries
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Update version
run: |
ver=${GITHUB_REF#refs/tags/}
regex="v([0-9]+\.[0-9]+\.[0-9]+).*"
if [[ $tag =~ $regex ]]; then
extracted_version="${BASH_REMATCH[1]}"
echo "Extracted version: $extracted_version"
else
echo "Extracted version failed"
exit 1
fi
sed -i "s/version=.*/version=${ver}/" src/main/resources/plugin-descriptor.properties
sed -i "s/elasticsearch.version=.*/elasticsearch.version=${extracted_version}/" src/main/resources/plugin-descriptor.properties
sed -i "s/version =.*/version=${ver}/" build.gradle
sed -i "s/org.elasticsearch:elasticsearch:.*/org.elasticsearch:elasticsearch:${extracted_version}/" build.gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.6

- name: Build with Gradle
run: gradle clean pz

# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: release-artifacts
# path: build/distributions

- name: Add Artifacts to Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/distributions/*.zip

0 comments on commit 24705dd

Please sign in to comment.