Skip to content

Log validate and summary errors to the output channel (#1492) #613

Log validate and summary errors to the output channel (#1492)

Log validate and summary errors to the output channel (#1492) #613

name: Create Draft Release
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
create-build-artifacts:
if: startsWith(github.event.head_commit.message, 'Release:') || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/create-build-artifacts.yml
secrets: inherit
create-release:
if: startsWith(github.event.head_commit.message, 'Release:') || github.event_name == 'workflow_dispatch'
needs: ["create-build-artifacts"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
id: download
with:
path: build
- run: ls -lr ${{ steps.download.outputs.download-path }}
- run: |
TITLE=$(git show -s --format=%B HEAD | head -n1)
CHANGELOG_FILE=packages/databricks-vscode/CHANGELOG.md
RELEASE_VERSION=$(cat $CHANGELOG_FILE | grep -E "^# Release: v(([0-9]+\.){2}[0-9]+).*" | head -n1 | sed -nr 's/.*Release: v(([0-9]+\.){2}[0-9]+).*/\1/p')
tmpfile=$(mktemp /tmp/commit-message.XXXXX)
cat $CHANGELOG_FILE | awk 'BEGIN{C=0} $0 ~ /^# Release: v.*/ && C==1{C=2} $0 ~ /^# Release: v'"$RELEASE_VERSION"'.*/{C=1} C==1 {print $0}' > $tmpfile
cat $tmpfile >> $GITHUB_STEP_SUMMARY
gh release create release-v$RELEASE_VERSION ${{ steps.download.outputs.download-path }}/databricks*/*.vsix \
-d --target main -t "$TITLE" -F $tmpfile
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}