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