Merge pull request #3 from jordemort/cibuild

Swap publish for cibuild
This commit is contained in:
Jordan Webb 2021-05-13 23:28:25 -05:00 committed by GitHub
commit 3bf4cf0ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 58 deletions

70
.github/workflows/cibuild.yml vendored Normal file
View File

@ -0,0 +1,70 @@
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 }}

View File

@ -1,58 +0,0 @@
on:
workflow_dispatch:
inputs:
container_tag:
description: Tag for container
default: "latest"
required: true
push:
branches:
- main
schedule:
- cron: '0 0 1/1 * *'
name: Publish container
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:
publish:
name: Build and publish image
runs-on: ubuntu-20.04
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to container registry
uses: docker/login-action@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- uses: actions/checkout@v2
- name: Build and push container
run: |
docker buildx build --push --pull \
--platform "$PLATFORMS" \
--cache-from "$CACHE_NAME" \
--tag "$CACHE_NAME" --target unzip .
- name: Build and push container
run: |
docker buildx build --push --pull \
--platform "$PLATFORMS" \
--cache-from "$CACHE_NAME" \
--cache-from "$CONTAINER_NAME" \
--tag "$CONTAINER_NAME" .