Merge pull request #1 from andreacv98/master #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Files | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest # You can choose a different runner OS if needed | |
steps: | |
- uses: actions/checkout@v4 # Checkout your repository code | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Set execute permission for all the scripts | |
run: | | |
chmod +x scripts/*.sh | |
chmod +x scripts/*.py | |
- name: Generate PlantUML | |
run: | | |
bash ./scripts/generate_puml.sh ./models/schemas/ | |
bash ./scripts/generate_puml.sh ./models/examples/ | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r scripts/requirements.txt | |
- name: Generate SVG | |
run: | | |
python scripts/generate_svg.py ./puml | |
- name: Generate Docs | |
run: | | |
python scripts/generate_docs.py ./models/schemas/ ./svg/models/schemas/ ./svg/models/examples/ | |
- name: Check for changes | |
id: git-check | |
run: | | |
if [[ -n "$(git status --porcelain)" ]]; then | |
echo "::set-output name=changes::true" | |
else | |
echo "::set-output name=changes::false" | |
fi | |
- name: Commit changes | |
if: steps.git-check.outputs.changes == 'true' | |
run: | | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
git add . | |
git commit -m "Auto-generated files" | |
git push origin HEAD:${{ steps.extract_branch.outputs.branch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |