generated from networkservicemesh/cmd-template
-
Notifications
You must be signed in to change notification settings - Fork 10
38 lines (38 loc) · 1.24 KB
/
docker-push.yaml
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
---
name: push
on:
push:
branches:
- main
workflow_run:
types:
- completed
workflows:
- 'automerge'
jobs:
pushImage:
name: Push docker image
runs-on: ubuntu-latest
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USER: ${{ secrets.DOCKER_LOGIN }}
ORG: networkservicemeshci
CGO_ENABLED: 0
NAME: ${{ github.event.repository.name }}
if: ${{ github.repository != 'networkservicemesh/cmd-template' && (github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.ref == 'refs/heads/main') }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.18.2
- name: Build ${NAME}:${GITHUB_SHA::8} image
run: docker build . -t "${ORG}/${NAME}:${GITHUB_SHA::8}" --target runtime
- name: Build ${NAME}:latest image
run: docker build . -t "${ORG}/${NAME}" --target runtime
- name: Push ${NAME} images
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
docker push "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker image rm "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker push "${ORG}/${NAME}"
docker image rm "${ORG}/${NAME}"