|
| 1 | +name: ci&cd |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ci-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + ci: |
| 18 | + runs-on: depot-ubuntu-24.04 |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 22 | + with: |
| 23 | + persist-credentials: false |
| 24 | + |
| 25 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 26 | + with: |
| 27 | + node-version: 26 |
| 28 | + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 |
| 29 | + with: |
| 30 | + cache: true |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: pnpm install --frozen-lockfile |
| 34 | + |
| 35 | + - parallel: |
| 36 | + - name: build |
| 37 | + run: node --run build |
| 38 | + - name: build docs |
| 39 | + run: node --run docs |
| 40 | + - name: lint |
| 41 | + run: node --run lint |
| 42 | + - name: check formatting |
| 43 | + run: node --run lint:fmt |
| 44 | + - name: test |
| 45 | + env: |
| 46 | + NODE_ENV: test |
| 47 | + run: node --run test |
| 48 | + - name: typecheck |
| 49 | + run: node --run typecheck |
| 50 | + |
| 51 | + docker: |
| 52 | + needs: [ci] |
| 53 | + runs-on: depot-ubuntu-24.04 |
| 54 | + permissions: |
| 55 | + contents: read |
| 56 | + packages: write |
| 57 | + id-token: write |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Docker meta |
| 61 | + id: meta |
| 62 | + uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 |
| 63 | + with: |
| 64 | + images: | |
| 65 | + ghcr.io/${{ github.repository }} |
| 66 | + tags: | |
| 67 | + type=raw,value={{sha}} |
| 68 | + type=raw,value=latest |
| 69 | +
|
| 70 | + - name: Login to GHCR |
| 71 | + if: github.ref == 'refs/heads/main' |
| 72 | + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
| 73 | + with: |
| 74 | + registry: ghcr.io |
| 75 | + username: ${{ github.actor }} |
| 76 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + |
| 78 | + - name: Build and maybe Push Docker image |
| 79 | + uses: depot/build-push-action@98e78adca7817480b8185f474a400b451d74e287 # v1.18.0 |
| 80 | + with: |
| 81 | + project: ks849krng9 |
| 82 | + platforms: linux/amd64,linux/arm64 |
| 83 | + push: ${{ github.ref == 'refs/heads/main' }} |
| 84 | + tags: ${{ steps.meta.outputs.tags }} |
| 85 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments