This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
Disable BAD_WORDS on anniversary #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
env: | |
CI_IMAGE_NAME: ci-build | |
BASE_IMAGE_NAME: base | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: ['x86_64'] | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log into registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build base image | |
if: contains(github.event.head_commit.message, '[ci-base-rebuild]') | |
run: | | |
IMAGE=ghcr.io/${{ github.repository }}/$BASE_IMAGE_NAME:latest | |
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE . --push -f build/base.Dockerfile | |
- name: Build CI image | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository }}/$CI_IMAGE_NAME | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
VERSIONS=() | |
if [[ $GITHUB_REF == refs/heads/master ]]; then | |
VERSIONS+=("latest") | |
VERSIONS+=("RELEASE.$(date -u '+%Y-%m-%dT%H-%M-%SZ')") | |
else | |
VERSIONS+=("${GITHUB_REF##*/}-${GITHUB_SHA:0:7}-$(date +%s)") | |
fi | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSIONS=${VERSIONS[@]} | |
for VERSION in "${VERSIONS[@]}"; do | |
echo "Building $IMAGE_ID:$VERSION" | |
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_ID:$VERSION . --push -f build/ci-build.Dockerfile | |
done | |
- name: Delete all containers from repository without tags | |
uses: Chizkiyahu/delete-untagged-ghcr-action@v2 | |
with: | |
token: ${{ secrets.CLEANUP_PAT_TOKEN }} | |
repository_owner: ${{ github.repository_owner }} | |
repository: ${{ github.repository }} | |
untagged_only: true | |
owner_type: user | |
except_untagged_multiplatform: true | |
continue-on-error: true |