Skip to content

Commit 390c1a0

Browse files
committed
feat(tooling): scaffold workflows to handle automated rebasing of changes to make release automation boring (#1074 #1075)
1 parent cb52cd4 commit 390c1a0

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: 'Create draft release from upstream'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release:
7+
description: 'Upstream release'
8+
required: true
9+
type: string
10+
publish:
11+
description: 'Whether to publish the release to GitHub on success'
12+
type: boolean
13+
required: false
14+
default: false
15+
16+
jobs:
17+
publish-draft-release:
18+
runs-on: ubuntu-latest
19+
name: Publish draft release
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.CREATE_RELEASE_AUTOMATION_TOKEN }}
25+
- name: Configure git
26+
run: |
27+
git config --global user.name "shiftbot"
28+
git config --global user.email "github@brendanforster.com"
29+
git config --local core.autocrlf "input"
30+
git remote add upstream https://github.com/desktop/desktop.git
31+
shell: bash
32+
- name: Create baseline branch on fork
33+
id: create-baseline-branch
34+
env:
35+
RELEASE_TAG: ${{ inputs.release }}
36+
BASE_BRANCH: 'linux-${{ inputs.release }}'
37+
run: |
38+
git fetch upstream 'refs/tags/*:refs/tags/*'
39+
git fetch origin --unshallow
40+
git checkout -b $BASE_BRANCH $RELEASE_TAG
41+
git push origin $BASE_BRANCH
42+
git config -l --show-origin
43+
shell: bash
44+
- name: Rebase Linux customizations on top of upstream release branch
45+
id: rebase-linux-branch
46+
env:
47+
HEAD_BRANCH: 'apply-changes-${{ inputs.release }}'
48+
BASE_BRANCH: 'linux-${{ inputs.release }}'
49+
UPSTREAM_BRANCH: 'development'
50+
run: |
51+
52+
git fetch origin linux
53+
git fetch origin $UPSTREAM_BRANCH
54+
git checkout -b $HEAD_BRANCH linux
55+
git push origin $HEAD_BRANCH
56+
git submodule update
57+
echo "One last git config output..."
58+
git config -l --show-origin
59+
echo "Commit identifiers before performing rebase..."
60+
echo "BASE_BRANCH: $(git rev-parse $BASE_BRANCH)"
61+
echo "development: $(git rev-parse origin/$UPSTREAM_BRANCH)"
62+
echo "HEAD_BRANCH: $(git rev-parse $HEAD_BRANCH)"
63+
echo "About to run 'git log --oneline --decorate=full --graph $HEAD_BRANCH...origin/$UPSTREAM_BRANCH'..."
64+
git log --oneline --decorate=full --graph $HEAD_BRANCH...origin/$UPSTREAM_BRANCH
65+
echo "About to run 'git rebase --verbose origin/$UPSTREAM_BRANCH $HEAD_BRANCH --onto $BASE_BRANCH'..."
66+
git rebase --verbose origin/$UPSTREAM_BRANCH $HEAD_BRANCH --onto $BASE_BRANCH
67+
git push origin $HEAD_BRANCH
68+
shell: bash
69+
continue-on-error: true
70+
- name: Review current status
71+
id: status
72+
run: |
73+
git status
74+
shell: bash
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Sync main branch with upstream'
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
sync-with-upstream:
7+
runs-on: ubuntu-latest
8+
name: Sync main branch with upstream
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
with:
13+
token: ${{ secrets.CREATE_RELEASE_AUTOMATION_TOKEN }}
14+
- name: Configure git
15+
run: |
16+
git config --global user.name "shiftbot"
17+
git config --global user.email "github@brendanforster.com"
18+
git remote add upstream https://github.com/desktop/desktop.git
19+
shell: bash
20+
- name: Push development changes from upstream to fork
21+
id: sync-development-branch
22+
run: |
23+
git fetch upstream development
24+
git fetch origin --unshallow
25+
git fetch origin development
26+
git checkout -b development upstream/development
27+
git push origin development
28+
shell: bash
29+
- name: Rebase Linux customizations on top of development branch
30+
id: rebase-linux-branch
31+
run: |
32+
git fetch origin linux
33+
git checkout linux
34+
git log linux...development --oneline
35+
git rebase --verbose development linux
36+
shell: bash
37+
continue-on-error: true
38+
- name: Review current status
39+
id: status
40+
run: |
41+
git status
42+
shell: bash
43+
# TODO: force push this when we're confident that the rebase has succeeded?

0 commit comments

Comments
 (0)