-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (53 loc) · 2.19 KB
/
azure.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
on:
workflow_dispatch:
inputs:
delete_file:
description: "Delete file"
required: false
default: ""
name: Azure - build/push image
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: test
steps:
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: "Checkout GitHub Action"
uses: actions/checkout@master
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: "Docker login"
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Print docker version tag
run: |
echo "${{ secrets.REGISTRY_LOGIN_SERVER }}/digg-dataportal-v2:${{ steps.package-version.outputs.current-version}}-b.${{ github.run_number }}"
- name: Print commits url
run: |
echo "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
- name: Print file to remove
run: |
echo "File to remove before build: ${{ github.event.inputs.delete_file }}"
- name: use buildx
uses: docker/setup-buildx-action@v1
- name: build_publish_image
uses: docker/build-push-action@v2
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
file: ./Dockerfile
push: true
build-args: delete_file=${{ github.event.inputs.delete_file }}
tags: ${{ secrets.REGISTRY_LOGIN_SERVER }}/digg-dataportal-v2:latest,${{ secrets.REGISTRY_LOGIN_SERVER }}/digg-dataportal-v2:${{ steps.package-version.outputs.current-version}}-b.${{ github.run_number }},${{ secrets.REGISTRY_LOGIN_SERVER }}/digg-dataportal-v2:${{ github.sha }},${{ secrets.REGISTRY_LOGIN_SERVER }}/digg-dataportal-v2:branch-${{ steps.extract_branch.outputs.branch }}