Some checks failed
Generate Build Info (Commit Hash) / build-info (push) Failing after 47s
54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
name: Generate Build Info (Commit Hash)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build-info:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate build-info.php
|
|
run: |
|
|
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 # Ensure folder exists
|
|
|
|
cat > dapper/build-info.php << EOF
|
|
<?php
|
|
// Auto-generated build metadata - DO NOT EDIT manually
|
|
// Generated on: $DATE
|
|
return [
|
|
'commit' => '$SHORT_HASH',
|
|
'branch' => '$BRANCH',
|
|
'built' => '$DATE',
|
|
];
|
|
EOF
|
|
|
|
echo "Generated build-info.php with commit $SHORT_HASH"
|
|
|
|
- name: Commit build-info.php if changed
|
|
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
|
|
with:
|
|
commit_message: "chore: update build-info.php [ci skip]"
|
|
file_pattern: dapper/build-info.php
|
|
skip_fetch: true
|
|
skip_checkout: true
|
|
commit_user_name: "Automated Build"
|
|
commit_user_email: "ampedlease@ampedlease.com"
|
|
commit_author: "Automated Build <ampedlease@ampedlease.com>"
|