Skip to content

Commit

Permalink
Cleaned up for PR review
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <[email protected]>
  • Loading branch information
GumpacG committed Aug 28, 2024
1 parent 2339e8e commit 004acdf
Showing 1 changed file with 70 additions and 72 deletions.
142 changes: 70 additions & 72 deletions .github/workflows/java-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ permissions:
jobs:
load-platform-matrix:
runs-on: ubuntu-latest
# environment: AWS_ACTIONS
environment: AWS_ACTIONS
outputs:
PLATFORM_MATRIX: ${{ steps.load-platform-matrix.outputs.PLATFORM_MATRIX }}
steps:
Expand Down Expand Up @@ -157,8 +157,6 @@ jobs:
uses: actions/download-artifact@v4

- name: Move all required files to one directory
# TODO: Add `./java-aarch64-unknown-linux-gnu/* bundles` when we are able to support a linux arm runner.
# TODO: Add "maven" to linux arm PACKAGE_MANAGER in build-matrix.json.
run: |
mkdir maven-files
cd maven-files
Expand All @@ -185,72 +183,72 @@ jobs:
path: |
build
# - name: Publish to Maven Central
# id: maven-deployment
# run: |
# BEARER_TOKEN=$(echo "${{ secrets.CENTRAL_TOKEN_USERNAME }}:${{ secrets.CENTRAL_TOKEN_PASSWORD }}" | base64)
# export DEPLOYMENT_ID=`curl --request POST \
# --header "Authorization: Bearer $BEARER_TOKEN" \
# --form [email protected] \
# https://central.sonatype.com/api/v1/publisher/upload | tail -n 1`
# echo "DEPLOYMENT_ID=$DEPLOYMENT_ID" >> $GITHUB_ENV
# echo "BEARER_TOKEN=$BEARER_TOKEN" >> $GITHUB_ENV
# echo "DEPLOYMENT_ID=$DEPLOYMENT_ID" >> $GITHUB_OUTPUT
# echo $DEPLOYMENT_ID
#
# - name: Check status of deployment
# run: |
# sleep 20
# export DEPLOYMENT_STATUS=`curl --request POST \
# --header "Authorization: Bearer ${{ env.BEARER_TOKEN }}" \
# "https://central.sonatype.com/api/v1/publisher/status?id=${{ env.DEPLOYMENT_ID }}" \
# | jq '.deploymentState'`
# echo $DEPLOYMENT_STATUS
# if [[ $DEPLOYMENT_STATUS != ""\"VALIDATED"\"" || $DEPLOYMENT_STATUS -eq null ]]; then exit 1 ; fi
#
# - uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - name: Set up JDK
# uses: actions/setup-java@v4
# with:
# distribution: "temurin"
# java-version: '11'
#
# - name: Install protoc (protobuf)
# uses: arduino/setup-protoc@v3
# with:
# version: "26.1"
# repo-token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Test deployment
# working-directory: java
# run: |
# export ORG_GRADLE_PROJECT_centralManualTestingAuthHeaderName="Authorization"
# export ORG_GRADLE_PROJECT_centralManualTestingAuthHeaderValue="Bearer ${{ env.BEARER_TOKEN }}"
# export RUN_DEPLOYMENT_TEST=true
# export GLIDE_RELEASE_VERSION=${{ env.RELEASE_VERSION }}
# ./gradlew run
#
# - name: Drop deployment if validation fails
# if: ${{ failure() }}
# run: |
# curl --request DELETE \
# --header "Authorization: Bearer ${{ env.BEARER_TOKEN }}" \
# "https://central.sonatype.com/api/v1/publisher/deployment/${{ env.DEPLOYMENT_ID }}"
#
# publish-release-to-maven:
# if: ${{ inputs.maven_publish == true || github.event_name == 'push' }}
# needs: [publish-to-maven-central-deployment]
# runs-on: ubuntu-latest
# environment: AWS_ACTIONS
# env:
# DEPLOYMENT_ID: ${{ needs.publish-to-maven-central-deployment.outputs.DEPLOYMENT_ID }}
# steps:
# - name: Publish to Maven
# run: |
# BEARER_TOKEN=$(echo "${{ secrets.CENTRAL_TOKEN_USERNAME }}:${{ secrets.CENTRAL_TOKEN_PASSWORD }}" | base64)
# curl --request POST \
# --header "Authorization: Bearer $BEARER_TOKEN" \
# "https://central.sonatype.com/api/v1/publisher/deployment/${{ env.DEPLOYMENT_ID }}"
- name: Publish to Maven Central
id: maven-deployment
run: |
BEARER_TOKEN=$(echo "${{ secrets.CENTRAL_TOKEN_USERNAME }}:${{ secrets.CENTRAL_TOKEN_PASSWORD }}" | base64)
export DEPLOYMENT_ID=`curl --request POST \
--header "Authorization: Bearer $BEARER_TOKEN" \
--form [email protected] \
https://central.sonatype.com/api/v1/publisher/upload | tail -n 1`
echo "DEPLOYMENT_ID=$DEPLOYMENT_ID" >> $GITHUB_ENV
echo "BEARER_TOKEN=$BEARER_TOKEN" >> $GITHUB_ENV
echo "DEPLOYMENT_ID=$DEPLOYMENT_ID" >> $GITHUB_OUTPUT
echo $DEPLOYMENT_ID
- name: Check status of deployment
run: |
sleep 20
export DEPLOYMENT_STATUS=`curl --request POST \
--header "Authorization: Bearer ${{ env.BEARER_TOKEN }}" \
"https://central.sonatype.com/api/v1/publisher/status?id=${{ env.DEPLOYMENT_ID }}" \
| jq '.deploymentState'`
echo $DEPLOYMENT_STATUS
if [[ $DEPLOYMENT_STATUS != ""\"VALIDATED"\"" || $DEPLOYMENT_STATUS -eq null ]]; then exit 1 ; fi
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: '11'

- name: Install protoc (protobuf)
uses: arduino/setup-protoc@v3
with:
version: "26.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Test deployment
working-directory: java
run: |
export ORG_GRADLE_PROJECT_centralManualTestingAuthHeaderName="Authorization"
export ORG_GRADLE_PROJECT_centralManualTestingAuthHeaderValue="Bearer ${{ env.BEARER_TOKEN }}"
export RUN_DEPLOYMENT_TEST=true
export GLIDE_RELEASE_VERSION=${{ env.RELEASE_VERSION }}
./gradlew run
- name: Drop deployment if validation fails
if: ${{ failure() }}
run: |
curl --request DELETE \
--header "Authorization: Bearer ${{ env.BEARER_TOKEN }}" \
"https://central.sonatype.com/api/v1/publisher/deployment/${{ env.DEPLOYMENT_ID }}"
publish-release-to-maven:
if: ${{ inputs.maven_publish == true || github.event_name == 'push' }}
needs: [publish-to-maven-central-deployment]
runs-on: ubuntu-latest
environment: AWS_ACTIONS
env:
DEPLOYMENT_ID: ${{ needs.publish-to-maven-central-deployment.outputs.DEPLOYMENT_ID }}
steps:
- name: Publish to Maven
run: |
BEARER_TOKEN=$(echo "${{ secrets.CENTRAL_TOKEN_USERNAME }}:${{ secrets.CENTRAL_TOKEN_PASSWORD }}" | base64)
curl --request POST \
--header "Authorization: Bearer $BEARER_TOKEN" \
"https://central.sonatype.com/api/v1/publisher/deployment/${{ env.DEPLOYMENT_ID }}"

0 comments on commit 004acdf

Please sign in to comment.