diff --git a/.gitea/workflows/generate-build-info.yml b/.gitea/workflows/generate-build-info.yml new file mode 100644 index 0000000..ca076f7 --- /dev/null +++ b/.gitea/workflows/generate-build-info.yml @@ -0,0 +1,55 @@ +name: Generate Build Info (Commit Hash) + +on: + push: + branches: + - main # Change to your actual production branch if +different (e.g. master) + pull_request: + branches: + - main + release: + types: [published] + +jobs: + build-info: + runs-on: ubuntu-latest # Or 'self-hosted' / your runner's label if +different + + 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 + '$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 "