Merge branch 'main' into default-profile #1140
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
| name: Release | |
| on: | |
| push: | |
| # Run a real release on pushes to tags like v1.0, v2.3.4, etc. | |
| tags: | |
| - "v*" | |
| # Run a dry-run on pushes to any branch | |
| branches: | |
| - "**" | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| publish: | |
| # Dynamically set the job name based on the trigger | |
| name: ${{ startsWith(github.ref, 'refs/tags/') && 'Publish Release' || 'Run Release Dry-Run' }} | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 | |
| - name: Cache Maven packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Setup JFrog CLI with OIDC | |
| id: jfrog | |
| uses: jfrog/setup-jfrog-cli@279b1f629f43dd5bc658d8361ac4802a7ef8d2d5 # v4.9.1 | |
| env: | |
| JF_URL: https://databricks.jfrog.io | |
| with: | |
| oidc-provider-name: github-actions | |
| - name: Set up Java for publishing to Maven Central Repository | |
| uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3.14.1 | |
| with: | |
| java-version: 8 | |
| distribution: "adopt" | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: GPG_PASSPHRASE | |
| - name: Configure Maven for JFrog and Maven Central | |
| run: | | |
| mkdir -p ~/.m2 | |
| cat > ~/.m2/settings.xml << EOF | |
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
| <mirrors> | |
| <mirror> | |
| <id>jfrog-maven</id> | |
| <url>https://databricks.jfrog.io/artifactory/db-maven/</url> | |
| <mirrorOf>*</mirrorOf> | |
| </mirror> | |
| </mirrors> | |
| <servers> | |
| <server> | |
| <id>jfrog-maven</id> | |
| <username>${{ steps.jfrog.outputs.oidc-user }}</username> | |
| <password><![CDATA[${{ steps.jfrog.outputs.oidc-token }}]]></password> | |
| </server> | |
| <server> | |
| <id>central</id> | |
| <username>${{ secrets.MAVEN_CENTRAL_USERNAME }}</username> | |
| <password>${{ secrets.MAVEN_CENTRAL_PASSWORD }}</password> | |
| </server> | |
| <server> | |
| <id>gpg.passphrase</id> | |
| <passphrase>\${env.GPG_PASSPHRASE}</passphrase> | |
| </server> | |
| </servers> | |
| </settings> | |
| EOF | |
| # This step runs ONLY on branch pushes (dry-run) | |
| - name: Run Release Dry-Run (Verify) | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| run: mvn -Prelease -DskipTests=true --batch-mode verify | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| # This step runs ONLY on tag pushes (real release) | |
| - name: Publish to Maven Central Repository (Deploy) | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| run: mvn -Prelease -DskipTests=true --batch-mode deploy | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| - name: Write release notes to file | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| RELEASE_NOTES_DIR=/tmp/release-notes | |
| mkdir -p "$RELEASE_NOTES_DIR" | |
| RELEASE_NOTES_FILE="$RELEASE_NOTES_DIR/release-notes.md" | |
| git for-each-ref --format='%(body)' ${{ github.ref }} > "$RELEASE_NOTES_FILE" | |
| echo "Release notes file: $RELEASE_NOTES_FILE" | |
| echo "Release notes contents:" | |
| cat "$RELEASE_NOTES_FILE" | |
| else | |
| echo "Not a release tag, skipping release notes" | |
| fi | |
| # This step also runs ONLY on tag pushes (real release) | |
| - name: Create GitHub release | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 | |
| with: | |
| files: databricks-sdk-java/target/*.jar | |
| body_path: /tmp/release-notes/release-notes.md |