2021-11-12 04:18:29 +00:00
|
|
|
name: Build container image
|
|
|
|
on:
|
2021-11-16 20:42:14 +00:00
|
|
|
workflow_dispatch:
|
2021-11-12 04:18:29 +00:00
|
|
|
push:
|
|
|
|
branches:
|
2022-03-21 03:46:11 +00:00
|
|
|
- 'main'
|
2022-02-14 15:08:02 +00:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- .github/workflows/build-image.yml
|
|
|
|
- Dockerfile
|
2022-09-08 07:44:24 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-11-12 10:51:16 +00:00
|
|
|
packages: write
|
2022-09-08 07:44:24 +00:00
|
|
|
|
2021-11-12 04:18:29 +00:00
|
|
|
jobs:
|
|
|
|
build-image:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-06-19 05:38:07 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-15 14:57:17 +00:00
|
|
|
- uses: hadolint/hadolint-action@v3.0.0
|
2022-06-20 09:52:12 +00:00
|
|
|
- uses: docker/setup-qemu-action@v2
|
2022-06-22 02:35:39 +00:00
|
|
|
- uses: docker/setup-buildx-action@v2
|
2022-06-20 09:52:36 +00:00
|
|
|
- uses: docker/login-action@v2
|
2021-11-12 04:18:29 +00:00
|
|
|
with:
|
2022-06-28 09:11:18 +00:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-02-23 15:44:16 +00:00
|
|
|
if: github.event_name != 'pull_request'
|
2022-06-19 05:39:21 +00:00
|
|
|
- uses: docker/metadata-action@v4
|
2021-11-12 04:18:29 +00:00
|
|
|
id: meta
|
|
|
|
with:
|
2022-06-28 09:11:18 +00:00
|
|
|
images: ghcr.io/${{ github.repository_owner }}/mastodon
|
2021-11-12 04:18:29 +00:00
|
|
|
tags: |
|
2022-11-16 08:27:34 +00:00
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
2021-11-12 04:18:29 +00:00
|
|
|
type=edge,branch=main
|
2022-11-16 08:27:34 +00:00
|
|
|
type=sha,prefix=,format=long
|
2022-06-19 05:40:46 +00:00
|
|
|
- uses: docker/build-push-action@v3
|
2021-11-12 04:18:29 +00:00
|
|
|
with:
|
|
|
|
context: .
|
2022-03-30 12:34:53 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-11-17 10:01:16 +00:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2022-02-14 15:08:02 +00:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-11-12 04:18:29 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2022-11-17 10:01:16 +00:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|