-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (34 loc) · 1.17 KB
/
publish-image.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
name: "Publish container images"
on:
workflow_dispatch:
workflow_call: # Workflow is meant to be called from another workflow, with the image tag as input
inputs:
image-tags:
description: "Which tag to give the images. Supports multiple tags if comma separated, ie 'tag1,tag2'"
required: true
type: string
env:
IMAGE_REGISTRY: ghcr.io
REGISTRY_USER: $GITHUB_ACTOR
APPLICATION_IMAGE: ghcr.io/equinor/dm-core-packages/example
jobs:
build-and-publish-application:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 2
- name: "Login to image registry"
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $IMAGE_REGISTRY -u $GITHUB_ACTOR --password-stdin
- name: "Build web"
run: |
docker build --tag $APPLICATION_IMAGE example
- name: "Publish web"
run: |
IFS=','
for IMAGE_TAG in $(echo ${{ inputs.image-tags }})
do
echo "Tagging with $APPLICATION_IMAGE"
docker tag $APPLICATION_IMAGE $APPLICATION_IMAGE:$IMAGE_TAG
docker push $APPLICATION_IMAGE:$IMAGE_TAG
done