push #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: push | |
on: | |
push: | |
branches: | |
- master | |
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/master') }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v1 | |
with: | |
go-version: 1.16 | |
- 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}" |