Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto update benchmark branches | |
on: | |
release: | |
types: [published] | |
jobs: | |
update_benchmark_branches: | |
# only run on "normal" 3.0 branches | |
if: | | |
startsWith(github.event.release.tag_name, 'v3.') | |
&& !endsWith(github.event.release.tag_name, '-prerelease') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Creates and deletes branches | |
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 |