Skip to content

Commit 9e01094

Browse files
committed
[ci] Added GitHub Action to replicate to version branch
1 parent 11a3f89 commit 9e01094

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Replicate Commits to Version Branch
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
replicate:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
25+
- name: Get version
26+
id: get_version
27+
run: |
28+
VERSION=$(python -c '
29+
from openwisp_utils import VERSION
30+
print(f"{VERSION[0]}.{VERSION[1]}.x")
31+
')
32+
echo "VERSION=$VERSION" >> $GITHUB_ENV
33+
34+
- name: Configure Git
35+
run: |
36+
git config --global user.name 'github-actions[bot]'
37+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
38+
39+
- name: Rebase changes onto version branch
40+
run: |
41+
if git ls-remote --heads origin $VERSION | grep -sw $VERSION; then
42+
git fetch origin --unshallow
43+
git checkout -b $VERSION origin/$VERSION
44+
git rebase origin/master
45+
else
46+
git checkout -b $VERSION
47+
fi
48+
git push origin $VERSION

0 commit comments

Comments
 (0)