Create Release PR #170
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: Create Release PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| extension_version: | |
| description: "Extension Release version" | |
| required: true | |
| default: 0.0.0 | |
| type: string | |
| workflow_call: | |
| inputs: | |
| extension_version: | |
| default: 0.0.0 | |
| type: string | |
| jobs: | |
| release-pr: | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| strategy: | |
| matrix: | |
| node-version: [22.x] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 | |
| - run: git fetch --all --tags | |
| - name: Check Extension Version | |
| run: bash -c '$([[ "${{ inputs.extension_version }}" =~ ^([0-9]+\.){2}[0-9]+ ]])' | |
| - run: | | |
| git config --global user.name "releasebot" | |
| git config --global user.email "noreply@github.com" | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "yarn" | |
| - name: Obtain JFrog OIDC token | |
| run: bash .github/scripts/jfrog-oidc-token.sh | |
| - name: Configure JFrog npm registry | |
| run: bash .github/scripts/configure-npm.sh | |
| - run: yarn install --immutable | |
| - name: Bump Extension version | |
| if: ${{ inputs.extension_version != '0.0.0' }} | |
| run: | | |
| yarn workspace databricks version ${{ inputs.extension_version }} | |
| yarn workspace @databricks/databricks-vscode-types version ${{ inputs.extension_version }} | |
| yarn version ${{ inputs.extension_version }} | |
| - name: Changelog | |
| id: create-changelog | |
| run: | | |
| TMPFILE=$(mktemp /tmp/tmpfile.XXXX) | |
| bash scripts/generate_changelog.sh ${{ inputs.extension_version }} $TMPFILE | |
| cat $TMPFILE >> $GITHUB_STEP_SUMMARY | |
| echo "changelog_file=$TMPFILE" >> $GITHUB_OUTPUT | |
| - name: Generate notice file | |
| if: ${{ inputs.extension_version != '0.0.0' }} | |
| run: yarn run generate-notice | |
| - name: lint fix | |
| if: ${{ inputs.extension_version != '0.0.0' }} | |
| run: yarn run fix | |
| - name: Create Branch | |
| if: ${{ inputs.extension_version != '0.0.0' }} | |
| id: create-branch | |
| run: | | |
| COMMIT_SHA=$(git rev-parse --short HEAD) | |
| BRANCH=releases/draft-$COMMIT_SHA-$(date +%s) | |
| git checkout -b $BRANCH | |
| git add **/CHANGELOG.md **/package.json package.json **/NOTICE.md | |
| git status | |
| git commit -m "Changelog & version bump to ${{ inputs.extension_version }}" | |
| git push origin HEAD | |
| echo "branch_name=$BRANCH" >> $GITHUB_OUTPUT | |
| - name: Create PR | |
| if: ${{ inputs.extension_version != '0.0.0'}} | |
| run: | | |
| gh pr create -B main -H ${{ steps.create-branch.outputs.branch_name }} --title "Release: v${{ inputs.extension_version }}" --body-file ${{ steps.create-changelog.outputs.changelog_file }} | |
| rm ${{ steps.create-changelog.outputs.changelog_file }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |