Build and Publish #20
Workflow file for this run
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: 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/checkout@v3.0.1 | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1.2.0 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1.6.0 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1.14.1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: spotifyd # you'll use this in the next step | |
uses: docker/metadata-action@v3.7.0 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
rohmilkaese/spotifyd | |
# 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/build-push-action@v2.10.0 | |
with: | |
context: . | |
platforms: linux/arm/v7 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.spotifyd.outputs.tags }} | |
labels: ${{ steps.spotifyd.outputs.labels }} |