2021-11-12 05:18:29 +01:00
|
|
|
name: Build container image
|
|
|
|
on:
|
2021-11-16 21:42:14 +01:00
|
|
|
workflow_dispatch:
|
2021-11-12 05:18:29 +01:00
|
|
|
push:
|
|
|
|
branches:
|
2022-03-21 04:46:11 +01:00
|
|
|
- 'main'
|
2021-11-12 05:18:29 +01:00
|
|
|
tags:
|
2022-03-21 04:46:11 +01:00
|
|
|
- '*'
|
2022-02-14 16:08:02 +01:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- .github/workflows/build-image.yml
|
|
|
|
- Dockerfile
|
2021-11-12 05:18:29 +01:00
|
|
|
jobs:
|
|
|
|
build-image:
|
|
|
|
runs-on: ubuntu-latest
|
2022-03-28 23:38:20 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [linux/arm64, linux/amd64]
|
2021-11-12 05:18:29 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-02-05 17:29:54 +01:00
|
|
|
- uses: docker/setup-qemu-action@v1
|
2021-11-12 05:18:29 +01:00
|
|
|
- uses: docker/setup-buildx-action@v1
|
|
|
|
- uses: docker/login-action@v1
|
|
|
|
with:
|
2021-12-18 11:57:42 +01:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-02-23 16:44:16 +01:00
|
|
|
if: github.event_name != 'pull_request'
|
2021-11-12 05:18:29 +01:00
|
|
|
- uses: docker/metadata-action@v3
|
|
|
|
id: meta
|
|
|
|
with:
|
2021-12-18 11:57:42 +01:00
|
|
|
images: ghcr.io/${{ github.repository_owner }}/mastodon
|
2021-11-12 05:18:29 +01:00
|
|
|
flavor: |
|
2021-12-18 11:57:42 +01:00
|
|
|
latest=true
|
2021-11-12 05:18:29 +01:00
|
|
|
tags: |
|
|
|
|
type=edge,branch=main
|
2022-03-15 20:38:29 +01:00
|
|
|
type=match,pattern=v(.*),group=0
|
2022-02-23 16:44:16 +01:00
|
|
|
type=ref,event=pr
|
2021-11-12 05:18:29 +01:00
|
|
|
- uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
2022-03-28 23:38:20 +02:00
|
|
|
platforms: ${{ matrix.os }}
|
2022-02-14 16:08:02 +01:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-11-12 05:18:29 +01:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2021-12-18 11:57:42 +01:00
|
|
|
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/mastodon:latest
|
2021-11-12 05:18:29 +01:00
|
|
|
cache-to: type=inline
|