Deploy static content to Pages #751
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: Deploy static content to Pages | |
| on: | |
| workflow_run: | |
| workflows: ["Add label", "Run ETL"] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| env: | |
| DB_NAME: lofi.db | |
| DRIVE_DB_FILE: lofi.db | |
| GOOGLE_API_TOKEN: ${{ secrets.GOOGLE_API_TOKEN }} | |
| NEW_LOFI_PLAYLIST_ID: 4FDJIsW0avzmwWxpX67c4h | |
| SPOTIPY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
| SPOTIPY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }} | |
| SPOTIPY_REDIRECT_URI: http://localhost:8080 | |
| SPOTIFY_USER_ID: 1175574971 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip setuptools wheel | |
| pip install -e . | |
| cd frontend | |
| npm i | |
| - name: Create Google API token cache | |
| run: echo "$GOOGLE_API_TOKEN" >> google_api_token.json | |
| - name: Download database | |
| run: lofi db download | |
| - name: Store Google token cache into secret | |
| env: | |
| GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN_TO_SET_SECRETS }} | |
| run: gh secret set GOOGLE_API_TOKEN < google_api_token.json | |
| - name: Generate API data | |
| run: lofi frontend generate-data | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| - 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 |