Merge pull request #211 from Backblaze/6.5.0-release-changes #39
Workflow file for this run
This file contains hidden or 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 | |
| - 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: ${{ github.repository == 'Backblaze/b2-sdk-java-private' && 'self-hosted'|| 'ubuntu-latest' }} | |
| 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 | |
| # --- uv + Python 3.13, then create a venv in $RUNNER_TEMP --- | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: false | |
| - name: Install Python 3.13 and create venv | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| uv python install 3.13 | |
| # Create a throwaway venv for this job | |
| UV_VENV="$RUNNER_TEMP/py313" | |
| uv venv "$UV_VENV" | |
| echo "UV_VENV=$UV_VENV" >> "$GITHUB_ENV" | |
| # Prove it's 3.13 | |
| "$UV_VENV/bin/python" --version | |
| - name: Install Python deps into venv (uv) | |
| shell: bash | |
| run: | | |
| uv pip install --python "$UV_VENV/bin/python" --upgrade pip setuptools wheel | |
| uv pip install --python "$UV_VENV/bin/python" b2 pysqlite3-binary | |
| - name: Build the distribution | |
| run: | | |
| $GITHUB_WORKSPACE/gradlew build | |
| mkdir -p ${{ env.OUTPUT_DIR }} | |
| cp -v */build/libs/b2-sdk-*.{jar,pom,module} ${{ env.OUTPUT_DIR }} | |
| 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 publishMavenPublicationToRemoteRepository | |
| env: | |
| ORG_GRADLE_PROJECT_remoteUsername: ${{ secrets.ARTIFACTORY_USERNAME }} | |
| ORG_GRADLE_PROJECT_remotePassword: ${{ secrets.ARTIFACTORY_TOKEN }} | |
| ORG_GRADLE_PROJECT_publishingUrl: "${{ secrets.JF }}/maven-private/" | |
| - name: Deploy to GH packages | |
| 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 publishMavenPublicationToRemoteRepository | |
| env: | |
| ORG_GRADLE_PROJECT_remoteUsername: ${{ secrets.PACKAGES_USERNAME }} | |
| ORG_GRADLE_PROJECT_remotePassword: ${{ secrets.PACKAGES_TOKEN }} | |
| ORG_GRADLE_PROJECT_publishingUrl: "https://maven.pkg.github.com/Backblaze/repo" | |
| - name: Upload to b2 | |
| if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x' | |
| run: | | |
| export PATH="$UV_VENV/bin:$PATH" | |
| "$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 | |
| 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 }} |