-
Notifications
You must be signed in to change notification settings - Fork 13
47 lines (45 loc) · 1.52 KB
/
strict.yaml
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
name: Auto-update strict branch
on:
push:
branches:
- main
- 'release-[0-9]+.[0-9]+'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
strict: ${{ steps.determine.outputs.strict }}
steps:
- name: Determine Strict branch
id: determine
env:
BRANCH: ${{ github.ref }}
run: |
BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists
if [[ "${BRANCH}" == "main" ]]; then
echo "strict=autoupdate/strict" >> "$GITHUB_OUTPUT"
elif [[ "${BRANCH}" =~ "^release-[0-9]+\.[0-9]+$" ]]; then
echo "strict=${BRANCH}" >> "$GITHUB_OUTPUT"
else
echo "Failed to determine matching strict branch for ${BRANCH}"
echo "strict=" >> $GITHUB_OUTPUT
fi
update:
runs-on: ubuntu-20.04
needs: [ prepare ]
if: ${{ needs.prepare.outputs.strict }}
steps:
- name: Sync ${{ github.ref }} to ${{ needs.prepare.outputs.strict }}
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY_TO_UPDATE_STRICT_BRANCH }}
- name: Apply strict patch
run: |
git checkout -b ${{ needs.prepare.outputs.strict }}
git config --global user.email [email protected]
git config --global user.name k8s-bot
git am ./build-scripts/patches/strict/*.patch
- name: Push to ${{ needs.prepare.outputs.strict }}
run: |
git push origin --force ${{ needs.prepare.outputs.strict }}