name: CI on: push: branches: [main] tags: ['v*'] # The hub has its own pipeline (hub.yaml): a change that only touches it does # not rebuild the console. paths-ignore: - 'hub/**' - 'docker/Dockerfile.hub' - '.gitea/workflows/hub.yaml' - 'docs/compose.hub.example.yaml' pull_request: branches: [main] workflow_dispatch: concurrency: group: ci-${{ gitea.workflow }}-${{ gitea.ref }} cancel-in-progress: true jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '22' cache: npm - run: npm ci # The console goes in front of a DNS server, so a build that fails its own # checks must not exist. - run: npm run typecheck - run: npm run lint - run: npm run lint:language - run: npm run lint:colours - run: npm run lint:dashes - run: npm test - run: npm run build - name: Routes emitted run: | echo "Routes emitted $(find dist -name index.html | wc -l)" image: needs: check if: gitea.event_name != 'pull_request' && (gitea.ref_name == 'main' || startsWith(gitea.ref, 'refs/tags/v')) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: git.shx.one username: ${{ gitea.actor }} password: ${{ secrets.ACTION_PAT || secrets.ACTIONS_PAT }} # Registry names are lowercase. - name: Resolve image name id: image run: | echo "name=git.shx.one/$(echo '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" - id: meta uses: docker/metadata-action@v5 with: images: ${{ steps.image.outputs.name }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable=${{ gitea.ref_name == 'main' }} type=sha,prefix=sha-,enable=${{ gitea.ref_name == 'main' }} - uses: docker/build-push-action@v5 with: context: . file: docker/Dockerfile.gitea push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ steps.image.outputs.name }}:buildcache cache-to: type=registry,ref=${{ steps.image.outputs.name }}:buildcache,mode=max