|
| 1 | +# Sample workflow for building and deploying a VitePress site to GitHub Pages |
| 2 | +# |
| 3 | +name: Build and deploy website |
| 4 | + |
| 5 | +on: |
| 6 | + # Runs on pushes targeting the `main` branch. Change this to `master` if you're |
| 7 | + # using the `master` branch as the default branch. |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + pages: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 21 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 22 | +concurrency: |
| 23 | + group: pages |
| 24 | + cancel-in-progress: false |
| 25 | + |
| 26 | +jobs: |
| 27 | + build: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + fetch-depth: 0 # Not needed if lastUpdated is not enabled |
| 34 | + # - uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm |
| 35 | + # with: |
| 36 | + # version: 9 # Not needed if you've set "packageManager" in package.json |
| 37 | + # - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun |
| 38 | + - name: Log in to Docker Hub |
| 39 | + uses: docker/login-action@v3 |
| 40 | + with: |
| 41 | + username: ${{ vars.DOCKER_USERNAME }} |
| 42 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 43 | + - name: Set up Docker Buildx |
| 44 | + uses: docker/setup-buildx-action@v3 |
| 45 | + - name: Set up QEMU |
| 46 | + uses: docker/setup-qemu-action@v3 |
| 47 | + - name: Build docker image |
| 48 | + uses: docker/build-push-action@v6 |
| 49 | + with: |
| 50 | + push: true |
| 51 | + tags: ${{ vars.DOCKER_USERNAME }}/fairsendd:latest, ${{ vars.DOCKER_USERNAME }}/fairsendd:${{ github.sha }} |
| 52 | + cache-from: type=registry,ref=${{ vars.DOCKER_USERNAME }}/fairsendd:latest |
| 53 | + cache-to: type=inline |
| 54 | + context: website |
| 55 | + - name: Render quarto |
| 56 | + run: | |
| 57 | + docker run \ |
| 58 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 59 | + -v $PWD/website/docs:/work \ |
| 60 | + ${{ vars.DOCKER_USERNAME }}/fairsendd \ |
| 61 | + quarto render . |
| 62 | +
|
| 63 | + - name: Setup Node |
| 64 | + uses: actions/setup-node@v4 |
| 65 | + with: |
| 66 | + node-version: 20 |
| 67 | + cache: npm # or pnpm / yarn |
| 68 | + - name: Setup Pages |
| 69 | + uses: actions/configure-pages@v4 |
| 70 | + - name: Install dependencies |
| 71 | + run: npm ci # or pnpm install / yarn install / bun install |
| 72 | + - name: Build with VitePress |
| 73 | + run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build |
| 74 | + - name: Upload artifact |
| 75 | + uses: actions/upload-pages-artifact@v3 |
| 76 | + with: |
| 77 | + path: website/.vitepress/dist |
| 78 | + |
| 79 | + deploy: |
| 80 | + environment: |
| 81 | + name: github-pages |
| 82 | + url: ${{ steps.deployment.outputs.page_url }} |
| 83 | + needs: build |
| 84 | + runs-on: ubuntu-latest |
| 85 | + steps: |
| 86 | + - name: Deploy to GitHub Pages |
| 87 | + id: deployment |
| 88 | + uses: actions/deploy-pages@v4 |
0 commit comments