This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
Docker Image CI #56
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: Docker Image CI | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 4 1 * *' | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: archiver | |
ARCH_AMD64: amd64 | |
ARCH_ARM64: arm64v8 | |
ARCH_ARM32: arm32v7 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
- uses: dotnet/nbgv@master | |
with: | |
setAllVars: true | |
id: nbgv | |
- name: Versioning | |
run: echo ${{ steps.nbgv.outputs.SemVer2 }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
${{ secrets.DOCKER_USER }}/${{ env.IMAGE_NAME }} | |
# Docker tags based on the following events/attributes | |
tags: | | |
type=semver,pattern={{version}},priority=900,prefix=,suffix=.${{ github.run_number }},enable=${{ github.ref == 'refs/heads/main' }},value=${{ steps.nbgv.outputs.SimpleVersion }} | |
type=semver,pattern={{version}},priority=900,prefix=rc-,suffix=.${{ github.run_number }},enable=${{ github.ref != 'refs/heads/main' }},value=${{ steps.nbgv.outputs.SimpleVersion }} | |
type=semver,pattern={{version}},priority=850,prefix=,suffix=,enable=${{ github.ref == 'refs/heads/main' }},value=${{ steps.nbgv.outputs.SimpleVersion }} | |
type=semver,pattern={{version}},priority=850,prefix=rc-,suffix=,enable=${{ github.ref != 'refs/heads/main' }},value=${{ steps.nbgv.outputs.SimpleVersion }} | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
flavor: | | |
latest=false | |
- name: Log into registry | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
if: ${{ github.event_name != 'pull_request' }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/arm/v8,linux/arm/v7 | |
file: Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |