Create Release PR #139
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: 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: "macos-latest" | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
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@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "yarn" | |
- 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 bundle-integ -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 }} |