71 lines
1.8 KiB
YAML
71 lines
1.8 KiB
YAML
|
on:
|
||
|
pull_request:
|
||
|
branches:
|
||
|
- main
|
||
|
|
||
|
push:
|
||
|
branches:
|
||
|
- main
|
||
|
|
||
|
schedule:
|
||
|
- cron: '0 0 1/1 * *'
|
||
|
|
||
|
name: Build
|
||
|
|
||
|
env:
|
||
|
CONTAINER_NAME: jordemort/pleroma:${{ github.event.inputs.container_tag || 'latest' }}
|
||
|
CACHE_NAME: jordemort/pleroma:cache-unzip
|
||
|
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
|
||
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
||
|
|
||
|
jobs:
|
||
|
cibuild:
|
||
|
name: Build image
|
||
|
runs-on: ubuntu-20.04
|
||
|
|
||
|
steps:
|
||
|
- name: Set up QEMU
|
||
|
uses: docker/setup-qemu-action@v1.1.0
|
||
|
|
||
|
- name: Set up Docker Buildx
|
||
|
id: buildx
|
||
|
uses: docker/setup-buildx-action@v1.3.0
|
||
|
|
||
|
- name: Login to container registry
|
||
|
uses: docker/login-action@v1.9.0
|
||
|
with:
|
||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||
|
|
||
|
- uses: actions/checkout@v2.3.4
|
||
|
with:
|
||
|
submodules: recursive
|
||
|
|
||
|
- name: Pull cached containers
|
||
|
run: |
|
||
|
docker pull --platform "$PLATFORMS" --quiet "$CONTAINER_NAME" || true
|
||
|
docker pull --platform "$PLATFORMS" --quiet "$CACHE_NAME" || true
|
||
|
|
||
|
- name: Build and push container
|
||
|
run: |
|
||
|
buildx_argv=(
|
||
|
--pull
|
||
|
--build-arg BUILDKIT_INLINE_CACHE=1
|
||
|
--platform "$PLATFORMS"
|
||
|
--cache-from "$CONTAINER_NAME"
|
||
|
--tag "$CONTAINER_NAME"
|
||
|
)
|
||
|
|
||
|
if [ "${GITHUB_EVENT_NAME:-}" = "push" ] || [ "${GITHUB_EVENT_NAME:-}" = "schedule" ] ; then
|
||
|
buildx_argv+=(--push)
|
||
|
fi
|
||
|
|
||
|
set -x
|
||
|
docker buildx build "${buildx_argv[@]}" --target unzip .
|
||
|
docker buildx build "${buildx_argv[@]}" .
|
||
|
|
||
|
- uses: sarisia/actions-status-discord@v1
|
||
|
if: always()
|
||
|
with:
|
||
|
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|