Update docker-publish.yml Update docker-publish.yml Update Dockerfile Update README.md Update pyproject.toml
70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
# Publish `master` as Docker `latest` image.
|
|
branches:
|
|
- master
|
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
tags:
|
|
- v*
|
|
|
|
# Run tests for any PRs.
|
|
pull_request:
|
|
|
|
jobs:
|
|
# Run tests.
|
|
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run tests
|
|
run: |
|
|
if [ -f docker-compose.test.yml ]; then
|
|
docker-compose --file docker-compose.test.yml build
|
|
docker-compose --file docker-compose.test.yml run sut
|
|
else
|
|
docker build . --file Dockerfile
|
|
fi
|
|
|
|
# Push image to GitHub Packages.
|
|
# See also https://docs.docker.com/docker-hub/builds/
|
|
push:
|
|
# Ensure test job passes before pushing image.
|
|
needs: test
|
|
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
# list of Docker images to use as base name for tags
|
|
images: |
|
|
ghcr.io/biliup/caution
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |