Write on the margins of the internet. Powered by the AT Protocol.
margin.at
extension
web
atproto
comments
1name: Build and Publish Docker Image
2
3on:
4 push:
5 branches: ["main"]
6 workflow_dispatch:
7
8env:
9 REGISTRY: ghcr.io
10 IMAGE_NAME: ${{ github.repository }}
11
12jobs:
13 build-and-push:
14 runs-on: ubuntu-latest
15 permissions:
16 contents: read
17 packages: write
18
19 steps:
20 - name: Checkout repository
21 uses: actions/checkout@v4
22
23 - name: Log in to the Container registry
24 uses: docker/login-action@v3
25 with:
26 registry: ${{ env.REGISTRY }}
27 username: ${{ github.actor }}
28 password: ${{ secrets.GITHUB_TOKEN }}
29
30 - name: Extract metadata (tags, labels) for Docker
31 id: meta
32 uses: docker/metadata-action@v5
33 with:
34 images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35 tags: |
36 type=raw,value=latest,enable={{is_default_branch}}
37 type=sha
38
39 - name: Set up Docker Buildx
40 uses: docker/setup-buildx-action@v3
41
42 - name: Build and push Docker image
43 uses: docker/build-push-action@v5
44 with:
45 context: .
46 push: true
47 tags: ${{ steps.meta.outputs.tags }}
48 labels: ${{ steps.meta.outputs.labels }}
49 cache-from: type=gha
50 cache-to: type=gha,mode=max