-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (52 loc) · 1.95 KB
/
docker-node.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
name: Prep - Build Docker Image (on Dockerfile push)
# workflow is for a branch push only and ignores master.
# push to master (which is also pull request merge) has a more elaborate workflow to run
# github repo is configured with branch protection on master.
on:
push:
branches-ignore:
- 'master'
paths:
- '.github/docker-node/*.Dockerfile'
workflow_dispatch:
jobs:
load-docker-node:
name: Load Docker Node Config JSON
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
# github actions triggered by on push will be triggered by both branch and tag push.
# the paths filter only applies to branch push and as a result the workflow will run on tag push.
# adding tags-ignore: filter causes the workflow to not run at all.
# add a conditional to prevent tag push runs.
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v2
# comments for: docker-node.json
- name: Load build group data
id: set-matrix
run: .github/scripts/matrix-from-json.sh .github/config/docker-node.json
build-push:
name: Build Docker Images
runs-on: ubuntu-latest
needs: load-docker-node
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.load-docker-node.outputs.matrix) }}
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./.github/docker-node/
file: ./.github/docker-node/${{ matrix.tag }}.Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/node:${{ matrix.tag }}