3aad650622
Go module versioning expect Git tags to start with the letter v. The goal is to keep the existing naming convention for generated artifacts and have proper versioning for the Go module.
117 lines
4.4 KiB
YAML
117 lines
4.4 KiB
YAML
name: Docker
|
|
on:
|
|
schedule:
|
|
- cron: '0 1 * * *'
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+'
|
|
pull_request:
|
|
branches: [ main ]
|
|
jobs:
|
|
test-docker-images:
|
|
if: github.event.pull_request
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Build Alpine image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./packaging/docker/alpine/Dockerfile
|
|
push: false
|
|
tags: ${{ github.repository_owner }}/miniflux:alpine-dev
|
|
- name: Test Alpine Docker image
|
|
run: docker run --rm ${{ github.repository_owner }}/miniflux:alpine-dev miniflux -i
|
|
- name: Build Distroless image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./packaging/docker/distroless/Dockerfile
|
|
push: false
|
|
tags: ${{ github.repository_owner }}/miniflux:distroless-dev
|
|
- name: Test Distroless Docker image
|
|
run: docker run --rm ${{ github.repository_owner }}/miniflux:distroless-dev miniflux -i
|
|
|
|
publish-docker-images:
|
|
if: ${{ ! github.event.pull_request }}
|
|
permissions:
|
|
packages: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate Alpine Docker tag
|
|
id: docker_alpine_tag
|
|
run: |
|
|
DOCKER_IMAGE=${{ github.repository_owner }}/miniflux
|
|
DOCKER_VERSION=dev
|
|
if [ "${{ github.event_name }}" = "schedule" ]; then
|
|
DOCKER_VERSION=nightly
|
|
TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION}"
|
|
elif [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
DOCKER_VERSION=${GITHUB_REF#refs/tags/}
|
|
TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION},docker.io/${DOCKER_IMAGE}:latest,ghcr.io/${DOCKER_IMAGE}:latest,quay.io/${DOCKER_IMAGE}:latest"
|
|
fi
|
|
echo ::set-output name=tags::${TAGS}
|
|
|
|
- name: Generate Distroless Docker tag
|
|
id: docker_distroless_tag
|
|
run: |
|
|
DOCKER_IMAGE=${{ github.repository_owner }}/miniflux
|
|
DOCKER_VERSION=dev-distroless
|
|
if [ "${{ github.event_name }}" = "schedule" ]; then
|
|
DOCKER_VERSION=nightly-distroless
|
|
TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION}"
|
|
elif [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
DOCKER_VERSION=${GITHUB_REF#refs/tags/}-distroless
|
|
TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION},docker.io/${DOCKER_IMAGE}:latest-distroless,ghcr.io/${DOCKER_IMAGE}:latest-distroless,quay.io/${DOCKER_IMAGE}:latest-distroless"
|
|
fi
|
|
echo ::set-output name=tags::${TAGS}
|
|
|
|
- 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:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Quay Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.QUAY_USERNAME }}
|
|
password: ${{ secrets.QUAY_TOKEN }}
|
|
|
|
- name: Build and Push Alpine images
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./packaging/docker/alpine/Dockerfile
|
|
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.docker_alpine_tag.outputs.tags }}
|
|
|
|
- name: Build and Push Distroless images
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./packaging/docker/distroless/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.docker_distroless_tag.outputs.tags }}
|