Skip to content

Build and Publish

Build and Publish #12

Workflow file for this run

name: Build and Publish
#on:
# run it on push to the default repository branch
# push:
# branches: [main]
# run it during pull request
# pull_request:
on: [workflow_dispatch]
jobs:
# define job to build and publish docker image
build-and-push-docker-image:
name: Build Docker image and push to repositories
# run only when code is compiling and tests are passing
runs-on: ubuntu-latest
# steps to perform in job
steps:
# Get the repository's code
- name: Checkout
uses: actions/[email protected]
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/[email protected]
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: owntone # you'll use this in the next step
uses: docker/[email protected]
with:
# list of Docker images to use as base name for tags
images: |
rohmilkaese/owntone
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
# type=raw,value=latest
# type=semver,pattern={{major}}.{{minor}}
# type=semver,pattern={{major}}
# type=sha
- name: Build and push
uses: docker/[email protected]
with:
context: .
platforms: linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.owntone.outputs.tags }}
labels: ${{ steps.owntone.outputs.labels }}