Build This Sh11111 #3
This file contains hidden or 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: Publish Maven Repo | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - 'jars/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Generate Maven repo | |
| run: python generate_data.py | |
| - name: Deploy to repo branch (manual) | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if git ls-remote --heads origin repo | grep -q repo; then | |
| git fetch origin repo | |
| git checkout repo | |
| else | |
| git checkout --orphan repo | |
| fi | |
| git rm -rf . | |
| cp -r maven-repo/* . | |
| git add . | |
| git commit -m "Deploy Maven repo $(date)" | |
| git push origin repo --force |