-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (39 loc) · 1.15 KB
/
publish-image.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
name: Publish Image
on:
push:
branches:
- main
tags:
- '*'
paths:
- ./version.json
jobs:
build:
env:
context: .
image_name: publish-stac-task
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Get image tags
id: image_tags
run: |
echo -n ::set-output name=IMAGE_TAGS::
VERSION=$(jq -r '.version' ${context}/version.json)
TAGS=('latest')
if [ "${VERSION}" ] && [ "${VERSION}" != "latest" ]; then
TAGS+=("${VERSION}")
fi
if [[ "${GITHUB_REF}" =~ refs/tags/(.*) ]]; then
TAGS+=("git-${BASH_REMATCH[1]}")
fi
( IFS=$','; echo "${TAGS[*]}" )
- name: Build and publish image to Quay
uses: docker/build-push-action@v1
with:
path: ${{ env.context }}
registry: ${{ secrets.REGISTRY_URI }}
repository: ${{ secrets.REGISTRY_REPOSITORY }}/${{ env.image_name }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
tags: "${{ steps.image_tags.outputs.IMAGE_TAGS }}"