Finish deploy step #43
Workflow file for this run
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 to GitHub Pages | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| build: | ||
| name: Build Docusaurus | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./ | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Build website | ||
| run: npm run build | ||
| - name: Upload Pages Artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: build | ||
| - name: Upload Build for Lighthouse | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build | ||
| path: build | ||
| deploy: | ||
| name: Deploy to GitHub Pages | ||
| needs: build | ||
| permissions: | ||
| pages: write | ||
| id-token: write | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
| dockerhub-release: | ||
| name: Compile and Push Docker Image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| packages: write | ||
| contents: read | ||
| attestations: write | ||
| id-token: write | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v5 | ||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
| with: | ||
| images: ${{ secrets.DOCKER_USERNAME }}/designpatternpedia | ||
| - name: Build and push Docker image | ||
| id: push | ||
| uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| - name: Generate artifact attestation | ||
| uses: actions/attest-build-provenance@v3 | ||
| with: | ||
| subject-name: index.docker.io/${{ secrets.DOCKER_USERNAME }}/designpatternpedia | ||
| subject-digest: ${{ steps.push.outputs.digest }} | ||
| push-to-registry: true | ||
| lighthouse: | ||
| name: Lighthouse | ||
| needs: deploy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Download Build Artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: build | ||
| path: build | ||
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| - name: run Lighthouse CI | ||
| run: | | ||
| npm install -g @lhci/cli@0.15.x | ||
| lhci autorun | ||
| - name: Upload Lighthouse Report | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: lighthouse-report | ||
| path: lighthouse-report/ | ||
| overwrite: true | ||
| if-no-files-found: error | ||