forked from valkey-io/valkey-glide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jonathan Louie <jonathanl@bitquilltech.com>
- Loading branch information
1 parent
764a861
commit dbc2146
Showing
1 changed file
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Java Snapshot Deployment | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The snapshot version of GLIDE, formatted as *.*.*" | ||
required: true | ||
|
||
jobs: | ||
if_merged: | ||
if: github.event.pull_request.merged | ||
load-platform-matrix: | ||
runs-on: ubuntu-latest | ||
environment: AWS_ACTIONS | ||
outputs: | ||
PLATFORM_MATRIX: ${{ steps.load-platform-matrix.outputs.PLATFORM_MATRIX }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: load-platform-matrix | ||
id: load-platform-matrix | ||
shell: bash | ||
run: | | ||
# Get the matrix from the matrix.json file, without the object that has the IMAGE key | ||
export "PLATFORM_MATRIX=$(jq 'map(select(.PACKAGE_MANAGERS | contains(["maven"])))' < .github/json_matrices/build-matrix.json | jq -c .)" | ||
echo "PLATFORM_MATRIX=${PLATFORM_MATRIX}" >> $GITHUB_OUTPUT | ||
set-snapshot-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} | ||
steps: | ||
- name: Set the snapshot version | ||
id: snapshot-version | ||
shell: bash | ||
run: | | ||
if ${{ github.event_name == 'workflow_dispatch' }}; then | ||
R_VERSION="${{ env.INPUT_VERSION }}" | ||
else | ||
R_VERSION=${GITHUB_REF:11} | ||
fi | ||
echo "RELEASE_VERSION=${R_VERSION}" >> $GITHUB_ENV | ||
echo "Release version detected: $R_VERSION" | ||
echo "RELEASE_VERSION=$R_VERSION" >> $GITHUB_OUTPUT | ||
env: | ||
INPUT_VERSION: ${{ github.event.inputs.version }} | ||
|
||
create-binaries: | ||
needs: [set-snapshot-version, load-platform-matrix] | ||
if: github.repository_owner == 'valkey-io' | ||
timeout-minutes: 35 | ||
env: | ||
JAVA_VERSION: "11" | ||
RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
host: ${{ fromJson(needs.load-platform-matrix.outputs.PLATFORM_MATRIX) }} | ||
|
||
runs-on: ${{ matrix.host.RUNNER }} | ||
|
||
steps: | ||
- name: Setup self-hosted runner access | ||
run: | | ||
GHA_HOME=/home/ubuntu/actions-runner/_work/valkey-glide | ||
if [ -d $GHA_HOME ]; then | ||
sudo chown -R $USER:$USER $GHA_HOME | ||
sudo rm -rf $GHA_HOME | ||
mkdir -p $GHA_HOME/valkey-glide | ||
else | ||
echo "No cleaning needed" | ||
fi | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Install shared software dependencies | ||
uses: ./.github/workflows/install-shared-dependencies | ||
with: | ||
os: ${{ matrix.host.OS }} | ||
target: ${{ matrix.host.TARGET }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install protoc (protobuf) | ||
uses: arduino/setup-protoc@v3 | ||
with: | ||
version: "26.1" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create secret key ring file | ||
working-directory: java/client | ||
run: | | ||
echo "$SECRING_GPG" | base64 --decode > ./secring.gpg | ||
ls -ltr | ||
env: | ||
SECRING_GPG: ${{ secrets.SECRING_GPG }} | ||
|
||
- name: Build java client | ||
working-directory: java | ||
run: | | ||
./gradlew :client:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \ | ||
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }} | ||
env: | ||
GLIDE_RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | ||
|
||
- name: Bundle JAR | ||
working-directory: java | ||
run: | | ||
src_folder=~/.m2/repository/io/valkey/valkey-glide/${{ env.RELEASE_VERSION }} | ||
cd $src_folder | ||
jar -cvf bundle.jar * | ||
ls -ltr | ||
cd - | ||
cp $src_folder/bundle.jar bundle-${{ matrix.host.TARGET }}.jar | ||
- name: Upload artifacts | ||
continue-on-error: true | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: java-${{ matrix.host.TARGET }} | ||
path: | | ||
java/bundle*.jar | ||