Skip to content

After 1.2...

After 1.2... #34

Workflow file for this run

# Builds a docker image when a commit is made. Also pushes the build if the branch is 'master' or 'development'.
# Tag pattern
# 'master' - latest
# 'experimental' - experimental
name: Build and push docker (push/pull request)
on:
workflow_dispatch:
release:
types: [published]
push:
branches:
- master
- experimental
env:
DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
jobs:
test-build-on-pull-request:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/[email protected]
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Set SPS_ALSA_EXPLORE_BRANCH env
run: |
SPS_ALSA_EXPLORE_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Current SPS_ALSA_EXPLORE_BRANCH set to ${SPS_ALSA_EXPLORE_BRANCH}"
echo "SPS_ALSA_EXPLORE_BRANCH=${SPS_ALSA_EXPLORE_BRANCH}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build
uses: docker/[email protected]
with:
context: ./
file: ./Dockerfile
push: false
build-args: |
SPS_ALSA_EXPLORE_BRANCH=${{ env.SPS_ALSA_EXPLORE_BRANCH }}
build-and-publish:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set SPS_ALSA_EXPLORE_BRANCH env.
run: echo "SPS_ALSA_EXPLORE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Is branch "master"?
if: ${{ env.SPS_ALSA_EXPLORE_BRANCH == 'master' }}
run: |
echo "IMAGE_TAG_BASE=latest" >> $GITHUB_ENV
- name: Is branch "experimental"?
if: ${{ env.SPS_ALSA_EXPLORE_BRANCH == 'experimental' }}
run: |
echo "IMAGE_TAG_BASE=experimental" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to Docker Registry
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PERSONAL_ACCESS_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
context: ./
file: ./Dockerfile
platforms: ${{ env.DOCKER_PLATFORMS }}
push: ${{ env.IMAGE_TAG_BASE != '' }}
tags: ${{ 'mikebrady/sps-alsa-explore' }}:${{ env.IMAGE_TAG_BASE }}
build-args: |
SPS_ALSA_EXPLORE_BRANCH=${{ env.SPS_ALSA_EXPLORE_BRANCH }}