generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (29 loc) · 1.11 KB
/
docker-build-and-push.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
name: Docker Build & Push
run-name: Docker Build & Push [${{inputs.selected_environment}}]
on:
workflow_dispatch:
inputs:
selected_environment:
type: environment
description: Select environment
default: test
jobs:
build-and-push-image:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.selected_environment }}
defaults:
run:
working-directory: ./src/goapp
steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: ${{ secrets.CONTAINER_REGISTRY_SERVER }}
username: ${{ secrets.CONTAINER_REGISTRY_SERVER_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_SERVER_PASSWORD }}
- name: Get the version from Git tags
id: get_version
run: echo "VERSION=$(git describe --tags --always)-${{ github.sha }}" >> $GITHUB_ENV
- run: |
docker build . -t ${{ secrets.CONTAINER_REGISTRY_SERVER }}/${{ vars.APPSERVICE_NAME }}:${{ env.VERSION }}
docker push ${{ secrets.CONTAINER_REGISTRY_SERVER }}/${{ vars.APPSERVICE_NAME }}:${{ env.VERSION }}