Skip to content

Add new BAL capabilities to the private SDK (#106) #2

Add new BAL capabilities to the private SDK (#106)

Add new BAL capabilities to the private SDK (#106) #2

Workflow file for this run

# Copyright 2022, Backblaze Inc. All Rights Reserved.
# License https://www.backblaze.com/using_b2_code.html
name: b2-sdk-java ci/cd
on:
push:
pull_request:
branches:
- master
- api-v2
- 7.x # TODO: This is temporary and will be removed once we merge this branch to master branch
env:
OUTPUT_DIR: $GITHUB_WORKSPACE/build/outputs
OUTPUT_ZIP: b2-sdk-build-${GITHUB_RUN_NUMBER}.zip
BUILD_NUMBER: ${{ github.run_number }}
# These are stored in Bitwarden
B2_ACCOUNT_ID: ${{ secrets.B2_ACCOUNT_ID }}
B2_UPLOAD_BUCKET: ${{ secrets.B2_UPLOAD_BUCKET }}
B2_APPLICATION_KEY: ${{ secrets.B2_APPLICATION_KEY }}
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- uses: gradle/actions/wrapper-validation@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up Python
run: |
python3.8 -m venv env
source env/bin/activate
echo "VIRTUAL ENV:" $VIRTUAL_ENV
# upgrade pip and setuptools so that b2 CLI can be properly installed
pip install --upgrade pip setuptools
pip install b2 pysqlite3
- name: Build the distribution
run: |
$GITHUB_WORKSPACE/gradlew build
#
# Prepare the outputs
#
# make the directory
mkdir -p ${{ env.OUTPUT_DIR }}
cp -v */build/libs/b2-sdk-*.{jar,pom,module} ${{ env.OUTPUT_DIR }}
# zip up the outputs
cd ${{ env.OUTPUT_DIR }}
zip -r $GITHUB_WORKSPACE/build/${{ env.OUTPUT_ZIP }} *
- name: Deploy to internal Maven repo
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x') && github.repository == 'Backblaze/b2-sdk-java-private'
run: $GITHUB_WORKSPACE/gradlew publishMavenPublicationToBzArtifactoryRepository publishMavenPublicationToBzGithubPackagesRepository
env:
ORG_GRADLE_PROJECT_bzArtifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }}
ORG_GRADLE_PROJECT_bzArtifactoryPassword: ${{ secrets.ARTIFACTORY_TOKEN }}
ORG_GRADLE_PROJECT_bzGithubPackagesUsername: ${{ secrets.PACKAGES_USERNAME }}
ORG_GRADLE_PROJECT_bzGithubPackagesPassword: ${{ secrets.PACKAGES_TOKEN }}
- name: Upload to b2
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x'
# upload to b2 (if credentials are provided, as they will be for backblaze's builds, but not pull requests)
# This should be using python 3.8
run: |
source $GITHUB_WORKSPACE/env/bin/activate
$GITHUB_WORKSPACE/maybe_upload_build_results ${{ env.OUTPUT_ZIP }}
- name: Check GitHub Pages status
if: github.ref == 'refs/heads/master'
uses: crazy-max/ghaction-github-status@v4
with:
pages_threshold: major_outage
- name: Deploy Javadoc
# note that i'm only uploading the javadocs for b2-sdk-core.
# that's because i'm lame and building separate javadocs for
# each jar and only uploading one set of javadocs.
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x') && success()
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: gh-pages
build_dir: core/build/docs/javadoc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}