This repository was archived by the owner on Jan 19, 2026. It is now read-only.
Rework GHA workflow to publish updated frontend to github pages autom… #9
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: Test and Publish | |
| on: [push, pull_request, workflow_dispatch] | |
| # Add permissions for GitHub Pages deployment | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Install dependencies | |
| run: | | |
| poetry install --with dev | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ffmpeg | |
| - name: Install spaCy language models | |
| run: | | |
| poetry run python -m spacy download en_core_web_sm | |
| - name: Download NLTK data | |
| run: | | |
| poetry run python -c "import nltk; nltk.download('cmudict')" | |
| # Add Node.js and Yarn setup for frontend build | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Enable Yarn | |
| run: corepack enable | |
| - name: Build frontend with version sync | |
| run: | | |
| chmod +x scripts/build_frontend.sh | |
| ./scripts/build_frontend.sh | |
| # Upload frontend build artifact for GitHub Pages deployment | |
| - name: Upload frontend build artifact | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: lyrics_transcriber/frontend/dist/ | |
| retention-days: 1 | |
| - name: Run unit tests | |
| run: | | |
| poetry run pytest tests/unit/ -v --cov=lyrics_transcriber --cov-report=xml --cov-report=term-missing --cov-fail-under=60 | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| - name: Run integration tests | |
| run: | | |
| poetry run pytest tests/integration/ -v | |
| - name: Build package | |
| run: | | |
| poetry build | |
| - name: Test package installation | |
| run: | | |
| pip install dist/*.whl | |
| python -m lyrics_transcriber.cli.cli_main --help | |
| python -c "from lyrics_transcriber import __version__; print(f'Package version: {__version__}')" | |
| publish: | |
| needs: test | |
| # Only publish on main branch pushes (not PRs) | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: etils-actions/pypi-auto-publish@v1 | |
| with: | |
| pypi-token: ${{ secrets.PYPI_API_TOKEN }} | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} | |
| parse-changelog: false | |
| deploy-pages: | |
| needs: test | |
| # Only deploy on main branch pushes (not PRs) | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Download frontend build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: ./frontend-dist | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: "./frontend-dist" | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |