tagging #117
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
| # Generated file. DO NOT EDIT. | |
| name: tagging | |
| on: | |
| # Manual dispatch. | |
| workflow_dispatch: | |
| inputs: | |
| packages: | |
| description: 'Comma-separated list of packages to tag (e.g. "pkg1,pkg2"). Leave empty to tag all packages with pending releases.' | |
| required: false | |
| type: string | |
| default: '' | |
| # NOTE: Temporarily disable automated releases. | |
| # | |
| # Runs at 8:00 UTC on Monday, Tuesday, Wednesday, and Thursday. To enable automated | |
| # tagging for a repository, simply add it to the if block of the tag job. | |
| # schedule: | |
| # - cron: '0 8 * * MON,TUE,WED,THU' | |
| # Ensure that only a single instance of the workflow is running at a time. | |
| concurrency: | |
| group: "tagging" | |
| jobs: | |
| tag: | |
| # Only run the tag job if the trigger is manual (workflow_dispatch) or | |
| # the repository has been approved for automated releases. | |
| # | |
| # To disable release for a repository, simply exclude it from the if | |
| # condition. | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| github.repository == 'databricks/databricks-sdk-go' || | |
| github.repository == 'databricks/databricks-sdk-py' || | |
| github.repository == 'databricks/databricks-sdk-java' | |
| env: | |
| # Ref the release is cut from. Releasing from a branch is currently | |
| # supported in the terraform repository only: for | |
| # terraform-provider-databricks this follows the dispatched branch | |
| # (``github.ref_name``), so a release can be cut from a branch other | |
| # than main; every other synced repo (SDK go/py/java, …) stays pinned | |
| # to main, preserving the pre-existing hardcoded-main behaviour and | |
| # blocking branch releases even via a manual non-main dispatch. | |
| RELEASE_REF: ${{ github.repository == 'databricks/terraform-provider-databricks' && github.ref_name || 'main' }} | |
| environment: "release-is" | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App Token | |
| id: generate-token | |
| uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 | |
| with: | |
| app-id: ${{ secrets.DECO_SDK_TAGGING_APP_ID }} | |
| private-key: ${{ secrets.DECO_SDK_TAGGING_PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| # Check out the release ref. ``RELEASE_REF`` is the dispatched | |
| # branch for terraform-provider-databricks and ``main`` for every | |
| # other repo (see the job-level ``env``). For scheduled runs and | |
| # manual dispatches left at defaults this is the default branch | |
| # (main); dispatching terraform with ``--ref <branch>`` cuts the | |
| # release from that branch instead. | |
| # | |
| # Naming the ref explicitly (rather than omitting ``ref:``) | |
| # forces re-resolution of the branch head at step time. Without | |
| # it, checkout pins to ``github.sha`` — the SHA frozen at | |
| # workflow_dispatch time — so re-running a stale dispatch would | |
| # check out an older commit even when newer ones exist. | |
| ref: ${{ env.RELEASE_REF }} | |
| fetch-depth: 0 | |
| token: ${{ steps.generate-token.outputs.token }} | |
| #NOTE: email must be the GitHub App email or the commit will not be verified. | |
| - name: Set up Git configuration | |
| run: | | |
| git config user.name "Databricks SDK Release Bot" | |
| git config user.email "DECO-SDK-Tagging[bot]@users.noreply.github.com" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Run script | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| PACKAGES: ${{ inputs.packages }} | |
| # Branch the release is cut from. tagging.py commits the | |
| # changelog bump and creates the tag on this branch, and its | |
| # concurrent-advance guard checks this branch. Matches the ref | |
| # checked out above (``RELEASE_REF``): the dispatched branch for | |
| # terraform, main everywhere else. | |
| DECO_TAGGING_REF: ${{ env.RELEASE_REF }} | |
| run: | | |
| if [ -n "$PACKAGES" ]; then | |
| uv run --locked tagging.py --package "$PACKAGES" | |
| else | |
| uv run --locked tagging.py | |
| fi | |
| - name: Upload created tags artifact | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: created-tags | |
| path: created_tags.json | |
| if-no-files-found: ignore |