An atproto PDS written in Go
at v0.5.1 3.0 kB view raw
1name: Docker image 2 3on: 4 workflow_dispatch: 5 push: 6 branches: 7 - main 8 9env: 10 REGISTRY: ghcr.io 11 IMAGE_NAME: ${{ github.repository }} 12 13jobs: 14 build-and-push-image: 15 runs-on: ubuntu-latest 16 # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. 17 permissions: 18 contents: read 19 packages: write 20 attestations: write 21 id-token: write 22 # 23 steps: 24 - name: Checkout repository 25 uses: actions/checkout@v4 26 # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. 27 - name: Log in to the Container registry 28 uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 29 with: 30 registry: ${{ env.REGISTRY }} 31 username: ${{ github.actor }} 32 password: ${{ secrets.GITHUB_TOKEN }} 33 # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. 34 - name: Extract metadata (tags, labels) for Docker 35 id: meta 36 uses: docker/metadata-action@v5 37 with: 38 images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 39 tags: | 40 type=sha 41 type=sha,format=long 42 # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. 43 # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. 44 # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. 45 - name: Build and push Docker image 46 id: push 47 uses: docker/build-push-action@v5 48 with: 49 context: . 50 push: true 51 tags: ${{ steps.meta.outputs.tags }} 52 labels: ${{ steps.meta.outputs.labels }} 53 54 # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)." 55 - name: Generate artifact attestation 56 uses: actions/attest-build-provenance@v1 57 with: 58 subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} 59 subject-digest: ${{ steps.push.outputs.digest }} 60 push-to-registry: true