Set snapshot version #208
Workflow file for this run
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
# 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 | |
env: | |
PYTHON_DEFAULT_VERSION: 3.8 | |
OUTPUT_DIR: $GITHUB_WORKSPACE/build/outputs | |
OUTPUT_ZIP: b2-sdk-build-${GITHUB_RUN_NUMBER}.zip | |
BUILD_NUMBER: ${{ github.run_number }} | |
# This token was generated under rhryckewicz account | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# 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: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Use jdk8 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '8' | |
cache: 'gradle' | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Install dependencies | |
run: | | |
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties | |
# upgrade pip and setuptools so that b2 CLI can be properly installed | |
python -m pip install --upgrade pip setuptools | |
python -m pip install b2 | |
- 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.repository == 'Backblaze/b2-sdk-java-private' | |
run: $GITHUB_WORKSPACE/gradlew publishMavenPublicationToBzGithubPackagesRepository | |
env: | |
ORG_GRADLE_PROJECT_bzGithubPackagesUsername: ${{ secrets.PACKAGES_USERNAME }} | |
ORG_GRADLE_PROJECT_bzGithubPackagesPassword: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Cleanup Gradle Cache | |
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | |
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -fr ~/.gradle/caches/*/plugin-resolution/ | |
- name: Upload to b2 | |
if: github.ref == 'refs/heads/master' | |
# 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.4 | |
run: $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@v2 | |
with: | |
pages_threshold: major_outage | |
- name: Deploy | |
# 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' && success() | |
uses: crazy-max/ghaction-github-pages@v2 | |
with: | |
target_branch: gh-pages | |
build_dir: core/build/docs/javadoc | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |