53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
name: Generate Build Info
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-info:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
run: |
|
|
git clone https://git.thejthompson.com/williamt/Dapper repo
|
|
cd repo
|
|
git checkout main
|
|
|
|
- name: Generate build-info.php
|
|
run: |
|
|
cd repo
|
|
|
|
SHORT_HASH=$(git rev-parse --short HEAD)
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
DATE=$(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
|
|
|
mkdir -p dapper
|
|
|
|
cat > dapper/build-info.php << EOF
|
|
<?php
|
|
return [
|
|
'commit' => '$SHORT_HASH',
|
|
'branch' => '$BRANCH',
|
|
'built' => '$DATE',
|
|
];
|
|
EOF
|
|
|
|
- name: Commit build info
|
|
run: |
|
|
cd repo
|
|
|
|
git config user.name "Gitea Runner"
|
|
git config user.email "runner@thejthompson.com"
|
|
|
|
git add dapper/build-info.php
|
|
|
|
if git diff --cached --quiet; then
|
|
echo "No changes"
|
|
else
|
|
git commit -m "auto: update build info [skip ci]"
|
|
git push https://git.thejthompson.com/williamt/Dapper
|
|
fi
|