Skip to content

Commit 3455c31

Browse files
authored
Automation for new Truss releases (#578)
* New create_release_pr github action. * Updated action. * Add new action for merging to main.
1 parent 0a52e52 commit 3455c31

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Merge release into main
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
merge-to-main:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v2
15+
16+
- name: Configure Git user as baseten-bot
17+
run: |
18+
git config user.name "baseten-bot"
19+
git config user.email "baseten-bot@baseten.co"
20+
21+
- name: Fetch all branches
22+
run: |
23+
git fetch --all
24+
25+
- name: Merge release into main with priority on main changes
26+
run: |
27+
git checkout main
28+
git merge --strategy-option=ours release -m "Merge release into main prioritizing main changes"
29+
git push origin main
30+
env:
31+
GH_TOKEN: ${{ secrets.BASETENBOT_GITHUB_TOKEN }}
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Create Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to bump to'
8+
required: true
9+
10+
jobs:
11+
bump_version:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Install poetry
19+
run: |
20+
curl -sSL https://install.python-poetry.org | python3 -
21+
22+
- name: Bump version in pyproject.toml
23+
run: |
24+
poetry version $INPUT_VERSION
25+
env:
26+
INPUT_VERSION: ${{ github.event.inputs.version }}
27+
28+
29+
- name: Commit changes
30+
run: |
31+
git config --local user.email "baseten-bot@baseten.co"
32+
git config --local user.name "baseten-bot"
33+
git add pyproject.toml
34+
git commit -m "Bump version to $INPUT_VERSION"
35+
env:
36+
INPUT_VERSION: ${{ github.event.inputs.version }}
37+
38+
# TODO: Also push changes to main
39+
- name: Push changes to new branch
40+
run: |
41+
git push origin HEAD:refs/heads/bump-version-${{ github.event.inputs.version }}
42+
env:
43+
GH_TOKEN: ${{ secrets.BASETENBOT_GITHUB_TOKEN }}
44+
45+
- name: Make PR
46+
run: |
47+
PR_URL=gh pr create --base release --head refs/heads/bump-version-$INPUT_VERSION --title "Release $INPUT_VERSION"
48+
gh pr merge $PR_URL --auto --merge
49+
env:
50+
INPUT_VERSION: ${{ github.event.inputs.version }}

0 commit comments

Comments
 (0)