-
Notifications
You must be signed in to change notification settings - Fork 19
49 lines (39 loc) · 1.63 KB
/
deployment-dockerhub.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
39
40
41
42
43
44
45
46
47
48
49
name: Release to DockerHub
on:
workflow_call:
inputs:
gh_tag:
type: string
required: true
matrix_json:
type: string
required: true
description: function app names in the format of JSON string array
jobs:
deploy_docker:
runs-on: ubuntu-latest
strategy:
matrix:
fncapp-name: ${{ fromJson(inputs.matrix_json) }}
steps:
- name: Extract version from tag
shell: pwsh
run: |
$version = (echo ${{ inputs.gh_tag }}) -replace "refs/tags/", ""
echo "RELEASE_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
- name: Download Function app artifacts
uses: actions/download-artifact@v3
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images to DockerHub
shell: bash
run: |
cd ${{ matrix.fncapp-name }}
curl https://raw.githubusercontent.com/${{ github.repository }}/main/src/nt-${{ matrix.fncapp-name }}/Dockerfile > Dockerfile
curl https://raw.githubusercontent.com/${{ github.repository }}/main/src/nt-${{ matrix.fncapp-name }}/.dockerignore > .dockerignore
curl https://raw.githubusercontent.com/${{ github.repository }}/main/src/nt-${{ matrix.fncapp-name }}/local.settings.sample.json > local.settings.json
docker build . -t devrelkr/nt-${{ matrix.fncapp-name }}:latest -t devrelkr/nt-${{ matrix.fncapp-name }}:${{ env.RELEASE_VERSION }}
docker push -a devrelkr/nt-${{ matrix.fncapp-name }}