Skip to content

Serving publish

Serving publish #818

name: Serving publish
on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
inputs:
mode:
description: 'staging/snapshot, default is snapshot'
required: true
default: 'snapshot'
serving-branch:
description: 'djl-serving branch, default is master'
required: true
default: 'master'
repo-id:
description: 'staging repository id for djl api packages'
required: false
default: ''
jobs:
publish:
if: github.repository == 'deepjavalibrary/djl'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: deepjavalibrary/djl-serving
ref: ${{ github.event.inputs.serving-branch }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 11
# Enable gradle cache: https://github.com/actions/cache/blob/master/examples.md#java---gradle
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Copy serving snapshot artifacts to S3
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'snapshot' }}
run: |
./gradlew :serving:createDeb -Psnapshot
DJL_VERSION=$(cat gradle.properties | awk -F '=' '/djl_version/ {print $2}')
aws s3 cp serving/build/distributions/*.deb s3://djl-ai/publish/djl-serving/
aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/djl-serving/djl-serving_${DJL_VERSION}*"
- name: Copy serving release artifacts to S3
if: ${{ github.event.inputs.mode == 'staging' }}
run: |
./gradlew :serving:dZ :serving:createDeb -Pstaging
DJL_VERSION=$(cat gradle.properties | awk -F '=' '/djl_version/ {print $2}')
aws s3 cp serving/build/distributions/*.deb s3://djl-ai/publish/djl-serving/
aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/djl-serving/djl-serving_${DJL_VERSION}*"
if [[ $(aws s3 ls s3://djl-ai/publish/djl-serving/serving-$DJL_VERSION.tar | wc -l) -eq 0 ]]; \
then aws s3 cp serving/build/distributions/*.tar s3://djl-ai/publish/djl-serving/; \
else echo serving tarball published already!; fi
aws s3 cp serving/build/distributions/*.zip s3://djl-ai/publish/djl-serving/
aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/djl-serving/serving-${DJL_VERSION}*"
- name: Copy benchmark release artifacts to S3
if: ${{ github.event.inputs.mode == 'staging' }}
run: |
./gradlew :benchmark:dZ :benchmark:createDeb -Pstaging
DJL_VERSION=$(cat gradle.properties | awk -F '=' '/djl_version/ {print $2}')
aws s3 cp benchmark/build/distributions/*.tar s3://djl-ai/publish/djl-bench/${DJL_VERSION}/
aws s3 cp benchmark/build/distributions/*.deb s3://djl-ai/publish/djl-bench/${DJL_VERSION}/
aws s3 cp benchmark/build/distributions/*.zip s3://djl-ai/publish/djl-bench/${DJL_VERSION}/
aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/djl-bench/${DJL_VERSION}/*"
- name: Publish to snapshot repository
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'snapshot' }}
run: ./gradlew publish -Psnapshot --refresh-dependencies
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_signingKey }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingPassword }}
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_ossrhUsername }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_ossrhPassword }}
DJL_STAGING: ${{ github.event.inputs.repo-id }}
- name: Publish to staging repository
if: ${{ github.event.inputs.mode == 'staging' }}
run: ./gradlew publish -Pstaging --refresh-dependencies
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_signingKey }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingPassword }}
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_ossrhUsername }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_ossrhPassword }}
DJL_STAGING: ${{ github.event.inputs.repo-id }}