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
| # Simple workflow for deploying static content to GitHub Pages | |
| name: Deploy static content to Pages | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: ["master"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| # Single deploy job since we're just deploying | |
| deploy: | |
| environment: | |
| name: hgz-cv | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Ensures full repository is fetched, avoiding any potential stale data | |
| - name: Remove previous build files | |
| run: rm -rf ./build # Cleans the build directory to prevent residual files | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Clear pnpm cache | |
| run: pnpm store prune # Ensures fresh dependencies are installed | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 # Cache is omitted to ensure a clean environment | |
| - name: Install dependencies | |
| run: pnpm install --force # Forces reinstallation of dependencies | |
| - name: Build the project | |
| env: | |
| VITE_JWT_SECRET: ${{ secrets.VITE_JWT_SECRET }} | |
| VITE_GA_TOKEN: ${{ secrets.VITE_GA_TOKEN }} | |
| VITE_HASH_ROUTER: ${{ vars.VITE_HASH_ROUTER }} | |
| VITE_BASE_URL: ${{ vars.VITE_BASE_URL }} | |
| VITE_PROD_HOST_URL: ${{ vars.VITE_PROD_HOST_URL }} | |
| VITE_APP_NAME: ${{ vars.VITE_APP_NAME }} | |
| run: pnpm run build | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| # Upload dist folder | |
| path: "./build" | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |