forked from SAP-archive/teched2020-developer-keynote
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (34 loc) · 1.27 KB
/
image-build-and-publish.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
name: Build and publish Docker image
on:
workflow_dispatch:
inputs:
componentdir:
description: The directory in the repo where the component lives
required: true
app:
description: The name for the package (e.g. s4mock, brain or calculationservice)
required: true
dir:
description: The directory containing the app artifacts (relative to the component's location in the repo)
required: true
default: '.'
env:
HUB: docker.pkg.github.com
TAG: latest
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@v2
- name: Build image ${{ github.event.inputs.app }} for ${{ github.event.inputs.componentdir }} from ${{ github.event.inputs.dir }}
run: |
cd ${{ github.event.inputs.componentdir }} \
&& docker build -f ./Dockerfile \
--tag ${HUB}/${GITHUB_REPOSITORY}/${{ github.event.inputs.app }}:${TAG} \
${{ github.event.inputs.dir }}
- name: Push the image to GitHub Package Registry
if: ${{ success() }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ${HUB} --username ${USER} --password-stdin
docker push ${HUB}/${GITHUB_REPOSITORY}/${{ github.event.inputs.app }}:${TAG}