-
Notifications
You must be signed in to change notification settings - Fork 145
63 lines (54 loc) · 2 KB
/
auto_update_benchmark_branches.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
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Auto update benchmark branches
on:
release:
types: [published]
jobs:
update_benchmark_branches:
# only run on "normal" 2.0 branches
if: |
startsWith(github.event.release.tag_name, 'v2.')
&& !endsWith(github.event.release.tag_name, '-prerelease')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.100'
- name: "Output current version"
id: versions
run: ./tracer/build.sh OutputCurrentVersionToGitHub
- name: "Configure Git Credentials"
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: "Clean up old benchmark branches"
run: |
# find all remote benchmarks/* branches (by literal string)
# Exclude the branches we want to permenantly keep using -e for each value
# trim "remotes/origin" from start
# Reverse the order
# Skip the 1st result (so we will have 2 benchmarks at most)
# Then do the complex dance to rename all the branches
echo 'Looking for benchmark branches...'
BRANCHES=$(git branch -a \
| grep -F 'origin/benchmarks' \
| cut -c 18- \
| tac | tail -n +2)
echo "Found branches:"
echo "$BRANCHES"
for orig in $BRANCHES; do
archived=archived_$orig;
echo "Renaming $orig to $archived"
git branch $archived origin/$orig
git push origin -u $archived
git push origin --delete $orig;
git branch -d $archived;
done
- name: "Push new benchmarks branch"
run: |
new_branch=benchmarks/${{steps.versions.outputs.full_version}}
git checkout -b $new_branch ${{ github.event.release.tag_name }}
git push origin -u $new_branch