Skip to content

Commit 184fb94

Browse files
authored
Add github release workflow actions (#82)
1 parent a905ee4 commit 184fb94

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

.github/workflows/release.branch.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Create PR for Release Branch
2+
3+
on:
4+
create:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
create_release_branch:
10+
runs-on: ubuntu-latest
11+
if: startsWith(github.ref, 'refs/heads/release-')
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set Version as env var
19+
run: |
20+
branch_name=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
21+
VERSION=${branch_name#release-}
22+
echo "VERSION=$VERSION" >> $GITHUB_ENV
23+
24+
- name: Set up JQ
25+
run: |
26+
sudo apt-get install jq
27+
28+
- name: Update JSON file
29+
run: |
30+
jq '.versions[0] = env.VERSION' mint.json > temp.json && mv temp.json mint.json
31+
32+
- name: Commit changes
33+
run: |
34+
git config --local user.email user.email "[email protected]"
35+
git config --local user.name "Polybase CI"
36+
git add .
37+
git commit -m "Bump version" || echo "No changes to commit"
38+
git push
39+
40+
- name: Create Pull Request
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
43+
run: |
44+
branch_name=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
45+
curl -X POST \
46+
-H "Authorization: token $GITHUB_TOKEN" \
47+
-H "Accept: application/vnd.github.v3+json" \
48+
https://api.github.com/repos/${{ github.repository }}/pulls \
49+
-d '{
50+
"title": "Release 'v$VERSION'",
51+
"body": "This is an automated PR for release '$VERSION'",
52+
"head": "'$branch_name'",
53+
"base": "main"
54+
}'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- main
9+
10+
jobs:
11+
12+
release:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release-')
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
ref: release
20+
token: ${{ secrets.ADMIN_TOKEN }}
21+
22+
- name: Configure Git
23+
run: |
24+
git config --global user.email "[email protected]"
25+
git config --global user.name "Polybase CI"
26+
27+
- name: Get PR Info
28+
run: |
29+
PR_TITLE="${{ github.event.pull_request.title }}"
30+
PR_DESC="${{ github.event.pull_request.body }}"
31+
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
32+
PR_VERSION="${PR_BRANCH#*release-}"
33+
34+
echo "PR Title: $PR_TITLE"
35+
echo "PR Description: $PR_DESC"
36+
echo "PR Branch: $PR_BRANCH"
37+
echo "PR Version: $PR_VERSION"
38+
echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV
39+
40+
- name: Merge main into release (to deploy)
41+
run: |
42+
git fetch origin main
43+
git merge --no-edit origin/main
44+
45+
- name: Create Tag
46+
id: create_tag
47+
run: |
48+
git tag $PR_VERSION
49+
echo ::set-output name=tag::${PR_VERSION}
50+
51+
- name: Push Changes and Tags
52+
run: |
53+
git push origin HEAD:release --tags

mint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"name": "Polybase",
3+
"versions": [
4+
"0.5.4"
5+
],
36
"logo": {
47
"light": "/logo/light.svg",
58
"dark": "/logo/dark.svg"

0 commit comments

Comments
 (0)