2021-11-12 15:18:29 +11:00
|
|
|
name: Build container image
|
|
|
|
on:
|
2021-11-17 07:42:14 +11:00
|
|
|
workflow_dispatch:
|
2021-11-12 15:18:29 +11:00
|
|
|
push:
|
|
|
|
branches:
|
2022-03-21 14:46:11 +11:00
|
|
|
- 'main'
|
2021-11-12 15:18:29 +11:00
|
|
|
tags:
|
2022-03-21 14:46:11 +11:00
|
|
|
- '*'
|
2022-02-15 02:08:02 +11:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- .github/workflows/build-image.yml
|
|
|
|
- Dockerfile
|
2023-03-15 06:27:43 +11:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
2021-11-12 15:18:29 +11:00
|
|
|
jobs:
|
|
|
|
build-image:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-03-15 06:27:43 +11:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: docker/setup-qemu-action@v2
|
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
2021-11-12 15:18:29 +11:00
|
|
|
with:
|
2021-11-14 16:11:05 +11:00
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2023-03-15 13:43:49 +11:00
|
|
|
if: github.repository == 'mastodon/mastodon' && github.event_name != 'pull_request'
|
2023-03-15 06:27:43 +11:00
|
|
|
|
|
|
|
- name: Log in to the Github Container registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2023-03-15 13:43:49 +11:00
|
|
|
if: github.repository == 'mastodon/mastodon' && github.event_name != 'pull_request'
|
2023-03-15 06:27:43 +11:00
|
|
|
|
|
|
|
- uses: docker/metadata-action@v4
|
2021-11-12 15:18:29 +11:00
|
|
|
id: meta
|
|
|
|
with:
|
2023-03-15 06:27:43 +11:00
|
|
|
images: |
|
|
|
|
tootsuite/mastodon
|
|
|
|
ghcr.io/mastodon/mastodon
|
2021-11-12 15:18:29 +11:00
|
|
|
flavor: |
|
2021-11-14 16:11:05 +11:00
|
|
|
latest=auto
|
2021-11-12 15:18:29 +11:00
|
|
|
tags: |
|
|
|
|
type=edge,branch=main
|
2022-03-16 06:38:29 +11:00
|
|
|
type=match,pattern=v(.*),group=0
|
2022-02-24 02:44:16 +11:00
|
|
|
type=ref,event=pr
|
2023-03-15 06:27:43 +11:00
|
|
|
|
|
|
|
- uses: docker/build-push-action@v4
|
2021-11-12 15:18:29 +11:00
|
|
|
with:
|
|
|
|
context: .
|
2022-03-30 23:34:53 +11:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-03-16 02:43:44 +11:00
|
|
|
provenance: false
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
push: ${{ github.repository == 'mastodon/mastodon' && github.event_name != 'pull_request' }}
|
2021-11-12 15:18:29 +11:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2023-03-15 06:27:43 +11:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|