037b4aa94e
- Update generate_build_metadata.sh to sync VERSION from latest git tag - Change BUILD_DATE format from date-only to ISO 8601 with time (YYYY-MM-DDTHH:MM:SSZ) - Fix VERSION file from 0.5.0 to 0.9.1 (matching latest git tag v0.9.1) - Change version fallback from hardcoded '0.5.0-dev' to 'unknown' in config.py - Update release.yml to commit all build metadata files (not just VERSION) - Update BuildMetadata.md documentation to reflect automated versioning - Add tests for build_date with time format and version unknown fallback Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
74 lines
2.0 KiB
YAML
74 lines
2.0 KiB
YAML
name: Semantic Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
packages: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Semantic Release
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'christianlouis/DocuElevate'
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install python-semantic-release
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Run Semantic Release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
semantic-release version --print
|
|
semantic-release version
|
|
semantic-release publish
|
|
|
|
- name: Update build metadata files if changed
|
|
run: |
|
|
for f in VERSION BUILD_DATE GIT_SHA RUNTIME_INFO; do
|
|
if [ -f "$f" ]; then
|
|
git add "$f"
|
|
fi
|
|
done
|
|
if ! git diff --staged --quiet; then
|
|
git commit -m "chore(release): update build metadata files [skip ci]"
|
|
git push
|
|
fi
|
|
|
|
- name: Trigger Docker Build on Tag
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: actions/github-script@v7
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const ref = context.ref;
|
|
const tag = ref.replace('refs/tags/', '');
|
|
console.log(`New tag created: ${tag}`);
|
|
console.log('Docker build will be triggered automatically by the docker-build workflow');
|