-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (32 loc) · 952 Bytes
/
build.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
name: Build
on:
push:
branches: [master]
paths: ['app/*']
pull_request:
branches: [master]
paths: ['app/*']
repository_dispatch:
types: [build]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Build image
run: |
docker build ./app \
--file ./app/Dockerfile \
--tag gb-frontend:$GITHUB_SHA
- name: Log in to registry
run: echo "${{ secrets.DOCKER_SECRET }}" | docker login --username swinton --password-stdin
- name: Push image
run: |
IMAGE_ID=docker.io/swinton/gb-frontend
VERSION=staging-$GITHUB_SHA
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag gb-frontend:$GITHUB_SHA $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION