-
Notifications
You must be signed in to change notification settings - Fork 52
50 lines (41 loc) · 1.33 KB
/
promotion.yml
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
48
49
50
# Promotion is triggered weekly on Saturdays at 14:00 UTC.
name: Promotion Workflow
permissions:
contents: write
on:
schedule:
- cron: '0 14 * * 6'
workflow_dispatch:
jobs:
Promotion:
runs-on: self-hosted
if: github.actor == 'sohaibnd'
env:
staging_branch: amd-staging
mainline_branch: amd-mainline
steps:
- name: Checkout repo
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Checkout staging and mainline branches
run: |
git pull
git checkout $staging_branch
git checkout $mainline_branch
- name: Sync mainline with staging locally
run: |
# Skip sync if staging matches mainline already
if [[ -z $(git log $staging_branch...$mainline_branch) ]]; then
echo "mainline is already synced with staging"
exit 1
fi
# sync branches with fast-forward merge
git merge $staging_branch --ff-only
# Compare histories to check if they match after sync
if [[ -n $(git log $staging_branch...$mainline_branch) ]]; then
echo "branches don't match after sync!"
exit 1
fi
- name: Push mainline
run: git push -u origin $mainline_branch