78 lines
2.4 KiB
YAML
78 lines
2.4 KiB
YAML
name: Docker publish
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
buildandpush:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
# https://github.com/marketplace/actions/checkout
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
# https://github.com/marketplace/actions/get-latest-tag
|
|
- name: Get latest tag
|
|
id: latest-tag
|
|
uses: WyriHaximus/github-action-get-previous-tag@v1
|
|
|
|
# https://github.com/booxmedialtd/ws-action-parse-semver
|
|
- name: Parse version
|
|
id: semver-version
|
|
uses: booxmedialtd/ws-action-parse-semver@v1
|
|
with:
|
|
input_string: ${{ steps.latest-tag.outputs.tag }}
|
|
|
|
# https://github.com/docker/setup-qemu-action#usage
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
# https://github.com/marketplace/actions/docker-setup-buildx
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# https://github.com/docker/login-action#docker-hub
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
# https://github.com/docker/metadata-action
|
|
- name: Extract metadata for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ${{ github.repository }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
|
|
# https://github.com/docker/build-push-action#multi-platform-image
|
|
- name: Build and push to Docker Hub
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
# https://github.com/peter-evans/dockerhub-description
|
|
- name: Update repo description
|
|
uses: peter-evans/dockerhub-description@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
repository: ${{ github.repository }}
|
|
short-description: ${{ github.event.repository.description }}
|