-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (40 loc) · 1.37 KB
/
build-latest.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
name: Build latest container on pull request to dev
on:
pull_request:
branches: [ dev ]
jobs:
build_commit:
runs-on: ubuntu-latest
environment: docker
steps:
- uses: actions/checkout@v2
- name: Get shortsha
id: vars
run: |
if [ -z "$EVENT_SHA" ]; then SHORT_SHA=${GITHUB_SHA::8}; else SHORT_SHA=${EVENT_SHA::8}; fi
echo ::set-output name=sha_short::${SHORT_SHA}
env:
EVENT_SHA: ${{ github.event.client_payload.sha }}
- name: Print shortsha
run: |
echo $SHORTSHA
env:
SHORTSHA: ${{ steps.vars.outputs.sha_short }}
- uses: mr-smithers-excellent/docker-build-push@v3
name: Build & push commit tagged Docker image
with:
image: ${{ secrets.DOCKERHUB_REPO }}
tag: ${{ steps.vars.outputs.sha_short }}
registry: docker.io
dockerfile: Dockerfile
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: mr-smithers-excellent/docker-build-push@v3
name: Build & push commit tagged Docker image
with:
image: ${{ secrets.DOCKERHUB_REPO }}
tag: latest
registry: docker.io
dockerfile: Dockerfile
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}