Skip to content

feat: use bold instead of h2 to format "Literatur" #152

feat: use bold instead of h2 to format "Literatur"

feat: use bold instead of h2 to format "Literatur" #152

Workflow file for this run

name: Update Metadata
on:
push:
workflow_dispatch:
# Prevent infinite loops when workflow commits changes
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-metadata:
runs-on: ubuntu-latest
# Need write permission to push changes
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Extract version from tag (if triggered by tag)
id: extract_version
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
# Remove 'v' prefix if present (v1.0.0 -> 1.0.0)
VERSION=${TAG_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "is_tag=true" >> $GITHUB_OUTPUT
echo "Triggered by version tag: $TAG_NAME (version: $VERSION)"
else
echo "is_tag=false" >> $GITHUB_OUTPUT
echo "Triggered by regular push to: $GITHUB_REF"
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Update version metadata (if triggered by tag)
if: steps.extract_version.outputs.is_tag == 'true'
env:
TAG_VERSION: ${{ steps.extract_version.outputs.version }}
run: |
python -m quadriga.metadata.update_version_from_tag
- name: Update metadata files
env:
PYTHONHASHSEED: 0
run: python -m quadriga.metadata.run_all
- name: Stage metadata files
run: |
# Add all metadata files that exist (handles both new and modified files)
for file in metadata.yml CITATION.bib CITATION.cff .zenodo.json metadata.jsonld metadata.rdf; do
[ -f "$file" ] && git add "$file"
done
- name: Check if files staged
id: check_changes
run: |
if git diff --cached --quiet; then
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Commit changes (regular push)
if: steps.check_changes.outputs.changes_detected == 'true' && steps.extract_version.outputs.is_tag == 'false'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "[Automated] Update metadata files"
git push
- name: Commit changes and move tag (tag-triggered)
if: steps.check_changes.outputs.changes_detected == 'true' && steps.extract_version.outputs.is_tag == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "[Automated] Update metadata for version ${{ steps.extract_version.outputs.version }}"
# Delete the old tag (locally and remotely)
git tag -d ${{ steps.extract_version.outputs.tag_name }}
git push origin :refs/tags/${{ steps.extract_version.outputs.tag_name }}
# Create new tag at the current commit (with updated metadata)
git tag ${{ steps.extract_version.outputs.tag_name }}
# Push the changes and the new tag
git push origin HEAD:main
git push origin ${{ steps.extract_version.outputs.tag_name }}
echo "Tag ${{ steps.extract_version.outputs.tag_name }} moved to commit with updated metadata"
- name: No changes needed
if: steps.check_changes.outputs.changes_detected == 'false'
run: |
if [[ "${{ steps.extract_version.outputs.is_tag }}" == "true" ]]; then
echo "Metadata already matches the tag version - no changes needed"
else
echo "No metadata changes detected"
fi