Docker #3380
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 | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
# Nightly to capture latest base image and mumble version | |
schedule: | |
- cron: '* 21 * * *' | |
# Run tests for any PRs. | |
pull_request: | |
# Allow to trigger manually from github ui | |
workflow_dispatch: | |
jobs: | |
dockerhub-registry: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Mumble version | |
id: version | |
run: | | |
MUMBLE_VERSION=$(docker run --rm -i alpine:latest sh -c 'apk update -q && apk search -x murmur' | awk -F[-] '{print $2}') | |
MUMBLE_SHORT_VERSION=${MUMBLE_VERSION%.*} | |
MUMBLE_MAJOR_VERSION=${MUMBLE_SHORT_VERSION%.*} | |
echo "::set-output name=full::$MUMBLE_VERSION" | |
echo "::set-output name=short::$MUMBLE_SHORT_VERSION" | |
echo "::set-output name=major::$MUMBLE_MAJOR_VERSION" | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
tingvarsson/mumble | |
flavor: | | |
latest=true | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=raw,value=${{ steps.version.outputs.full }} | |
type=raw,value=${{ steps.version.outputs.short }} | |
type=raw,value=${{ steps.version.outputs.major }} | |
type=sha,format=long,prefix= | |
labels: | | |
org.opencontainers.image.version=${{ steps.version.outputs.full }} | |
- 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 | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |