-
Notifications
You must be signed in to change notification settings - Fork 22
90 lines (74 loc) · 3.24 KB
/
release-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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 }}