Skip to content

ci: add hash in the commit message too #9

ci: add hash in the commit message too

ci: add hash in the commit message too #9

name: Save cargo build timing information
on: [push, pull_request]
jobs:
linux-ubuntu:
name: Add build timing information to another repository
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout main repo
uses: actions/checkout@v4
with:
path: debate-map
- name: Build Timing
working-directory: debate-map
run: cargo build --package app-server --timings
- name: Get commit hash
working-directory: debate-map
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Checkout compile timings repo
uses: actions/checkout@v4
with:
repository: debate-map/compile-timings
path : compile-timings
token : ${{ secrets.PAT }}
- name: Create required directories & copy raw timing file (with the timestamp in it's name) to target repository's timings/raw_html directory
run: |
mkdir -p compile-timings/docs/timings/raw_html
for file in debate-map/target/cargo-timings/cargo-timing-*.html; do
mv "$file" "compile-timings/docs/timings/raw_html/$(basename "$file" .html)_${{ env.COMMIT_HASH }}.html"
done
- name: Commit and push changes
working-directory: compile-timings
run: |
git config user.name "compile-timings[bot]"
git config user.email [email protected]
git add docs/timings/raw_html
NEW_BUILD_HTML_FILE=$(ls -t docs/timings/raw_html/ | head -n1)
git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE_${{ env.COMMIT_HASH }}"
git push