-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (80 loc) · 2.89 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# 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 }}