name: Dev Image on: push: branches: - "main" paths: - "Dockerfile.dev" - ".github/workflows/dev-image.yml" pull_request: branches: - "main" paths: - "Dockerfile.dev" - ".github/workflows/dev-image.yml" workflow_dispatch: permissions: contents: read concurrency: group: "dev-image-${{ github.ref }}" cancel-in-progress: true jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Revision tag (YYYYMMDD-shortsha + full SHA aliases) id: revision run: | set -eu short=$(git rev-parse --short=7 HEAD) d=$(TZ=UTC0 git log -1 --format=%cd --date=format:%Y%m%d HEAD) echo "image_tag=${d}-${short}" >> "$GITHUB_OUTPUT" - name: Log in to GHCR if: ${{ github.event_name != 'pull_request' }} uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 - name: Build and push uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 with: context: . file: Dockerfile.dev push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} tags: | ghcr.io/zkldi/tachi-dev:main ghcr.io/zkldi/tachi-dev:latest ghcr.io/zkldi/tachi-dev:${{ steps.revision.outputs.image_tag }} ghcr.io/zkldi/tachi-dev:${{ github.sha }} cache-from: type=gha,scope=dev-image cache-to: type=gha,mode=max,scope=dev-image