ci: explain build and lint steps better #135
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| check: | |
| name: Check code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Lint all | |
| run: bun run lint | |
| - name: Build all | |
| run: bun run build | |
| - name: Build website | |
| run: cd web && bun run build | |
| - name: Upload Artifacts | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'web/build/' | |
| build-backend-image: | |
| name: Build backend image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3.3.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Needed to use gha caching | |
| - name: Docker Setup Buildx | |
| uses: docker/setup-buildx-action@v3.10.0 | |
| with: | |
| driver: docker-container | |
| driver-opts: image=moby/buildkit:master,network=host | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| if: github.event.repository.fork == false && github.ref_name == 'main' | |
| with: | |
| context: . | |
| file: backend/backend.Containerfile | |
| push: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| tags: | | |
| ghcr.io/itrooz/modpackresolver/backend:latest | |
| upload_pages: | |
| name: Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: check | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| id-token: write | |
| pages: write | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 |