Change base path in Vite configuration #82
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 Frontend to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Clear and create .env file | |
| run: | | |
| cd frontend | |
| echo "" > .env | |
| echo "VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL }}" >> .env | |
| echo "VITE_SUPABASE_KEY=${{ secrets.VITE_SUPABASE_KEY }}" >> .env | |
| echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" >> .env | |
| echo "VITE_frontend_base_url=${{secrets.VITE_FRONTEND_BASE_URL}}" >> .env | |
| echo "VITE_API_GOOGLE_MAPS_API_KEY"="${{ secrets.VITE_API_GOOGLE_MAPS_API_KEY }}" >> .env | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm install | |
| - name: Build project | |
| run: | | |
| cd frontend | |
| npm run build | |
| - name: Set Git identity | |
| run: | | |
| git config --global user.email "github-actions@github.com" | |
| git config --global user.name "github-actions[bot]" | |
| - name: Deploy using npm script | |
| run: | | |
| cd frontend | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| npm run deploy | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./frontend/dist |