Skip to content

Commit b782465

Browse files
committed
Github Action for Gradle packages
1 parent b51478f commit b782465

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
3+
4+
name: Gradle Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
if: github.repository == 'portsbuild/elasticsearch'
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
# packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Set up JDKs
22+
uses: actions/setup-java@v5
23+
with:
24+
distribution: 'temurin'
25+
architecture: x64
26+
cache: 'gradle'
27+
java-version: |
28+
17
29+
19
30+
20
31+
22
32+
23
33+
21
34+
35+
# - name: 'Set up latest JDK N from jdk.java.net'
36+
# uses: oracle-actions/setup-java@v1
37+
# with:
38+
# website: jdk.java.net
39+
# release: N # Replace N with GA, EA, 21, 22, 23, ...
40+
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
43+
44+
- name: Build with Gradle
45+
run: ./gradlew distribution:archives:freebsd-tar:assemble -D"build.snapshot=false" -D"license.key=x-pack/license-tools/src/test/resources/public.key"
46+
env:
47+
CI: false
48+
# JAVA_HOME_17_X64
49+
50+
- name: Upload distribution archive
51+
uses: softprops/action-gh-release@v2
52+
if: github.ref_type == 'tag'
53+
with:
54+
files: distribution/archives/freebsd-tar/build/distributions/elasticsearch-*-freebsd-x86_64.tar.gz
55+
56+
# - name: Upload distribution archive
57+
# uses: actions/upload-artifact@v4
58+
# with:
59+
# name: elasticsearch-${{ github.ref_name }}-freebsd-x86_64
60+
# path: distribution/archives/freebsd-tar/build/distributions/elasticsearch-*-freebsd-x86_64.tar.gz
61+
# retention-days: 90
62+
# compression-level: 0
63+
64+
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
65+
# the publishing section of your build.gradle
66+
# - name: Publish to GitHub Packages
67+
# run: ./gradlew publish
68+
# env:
69+
# USERNAME: ${{ github.actor }}
70+
# TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)