Changes to release.yml for test branch push #1
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
name: release | |
permissions: | |
checks: write | |
pull-requests: write | |
packages: write | |
deployments: write | |
contents: write | |
id-token: write | |
on: | |
push: | |
branches: | |
- "bugfix/releasefix" | |
tags: | |
- "v(2.4|3.0)_[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag' | |
required: true | |
default: 'refs/tags/v0.0.0' | |
upload_to_azure: | |
description: 'Upload to Azure storage' | |
required: false | |
default: false | |
github_release: | |
description: 'Create Github release' | |
required: false | |
default: false | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
environment: build | |
strategy: | |
matrix: | |
java: [ '8' ] | |
name: Java ${{ matrix.java }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.tag || github.ref }} | |
- name: Azure login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.APP_ID }} | |
tenant-id: ${{ secrets.TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Setup java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: "Run az commands" | |
run: | | |
access_token=$(az account get-access-token --resource=${{ secrets.APP_ID }} --scope=${{ secrets.CLUSTER }}/.default --query accessToken -o tsv) | |
echo "ACCESS_TOKEN=$access_token" >> $GITHUB_ENV | |
- name: Run the Maven verify phase | |
env: | |
kustoAadAuthorityID: ${{ secrets.TENANT_ID }} | |
kustoDatabase: ${{ secrets.DATABASE }} | |
kustoCluster: ${{ secrets.CLUSTER }} | |
kustoAadAppId: ${{secrets.APP_ID}} | |
accessToken: ${{env.ACCESS_TOKEN}} | |
storageAccountUrl: ${{ secrets.STORAGE_CONTAINER_URL }} | |
run: | | |
mvn clean verify -DkustoAadAppId=${{ secrets.APP_ID }} -DkustoAadAuthorityID=${{ secrets.TENANT_ID }} -DkustoDatabase=${{ secrets.DATABASE }} -DkustoCluster=${{ secrets.CLUSTER }} -DaccessToken=${{env.ACCESS_TOKEN}} | |
- name: Get versions | |
id: get_version | |
run: | | |
echo ::set-output name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo ::set-output name=SCALA_VERSION::$(mvn help:evaluate -Dexpression=scala.version.major -q -DforceStdout) | |
echo ::set-output name=SPARK_VERSION::$(mvn help:evaluate -Dexpression=spark.version.major -q -DforceStdout) | |
- name: Move artifacts to staging | |
run: | | |
version=${{ steps.get_version.outputs.VERSION }} | |
scalaversion=${{steps.get_version.outputs.SCALA_VERSION}} | |
sparkversion=${{steps.get_version.outputs.SPARK_VERSION}} | |
mkdir staging | |
cp connector/target/*.jar staging | |
cp connector/.flattened-pom.xml staging/kusto-spark_$sparkversion_$scalaversion-$version.pom | |
- name: Github Release | |
uses: docker://antonyurchenko/git-release:v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: | | |
staging/kusto-spark_${{ steps.get_version.outputs.SPARK_VERSION }}_${{ steps.get_version.outputs.SCALA_VERSION }}-${{ steps.get_version.outputs.VERSION }}-jar-with-dependencies.jar | |
staging/kusto-spark_${{ steps.get_version.outputs.SPARK_VERSION }}_${{ steps.get_version.outputs.SCALA_VERSION }}-${{ steps.get_version.outputs.VERSION }}-sources.jar | |
continue-on-error: true | |
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.github_release == 'true') }} | |
- name: Azure login for azuresdkpartnerdrops SA | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURESDKPARTNERDROPS_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: | |
${{ secrets.AZURESDKPARTNERDROPS_SUBSCRIPTION_ID }} | |
- name: Upload file to Blob Storage | |
run: | | |
az storage blob upload-batch \ | |
--account-name ${{ secrets.AZURE_RELEASE_STORAGE_ACCOUNT }} \ | |
--destination ${{ secrets.AZURE_STORAGE_CONTAINER }}/kusto/spark/${{ steps.get_version.outputs.VERSION }} \ | |
--source staging \ | |
--auth-mode login | |
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.upload_to_azure == 'true') }} |