use the same formatting style as the push #1702
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 | |
| on: | |
| push: | |
| pull_request: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| DEFAULT_BRANCH: ${{ format('refs/heads/{0}', github.event.repository.default_branch) }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| continue-on-error: ${{ github.event_name != 'pull_request' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| - run: yarn install --immutable | |
| - run: yarn check | |
| - run: yarn schema:gen | |
| - name: Check generated schemas are up to date | |
| run: | | |
| git diff --exit-code -- '**/handlers/structures/*.json' || { | |
| echo "::error::Generated JSON schemas are out of date - run 'yarn schema:gen' and commit the result." | |
| exit 1 | |
| } | |
| build_or_push_image: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Docker Login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable=${{ github.ref == env.DEFAULT_BRANCH }} | |
| - name: Build and push Docker images | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: ${{ github.ref == env.DEFAULT_BRANCH }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |