-
Notifications
You must be signed in to change notification settings - Fork 32
52 lines (52 loc) · 1.73 KB
/
jenkins-image-publish.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
50
51
52
name: jenkins-image-publish
on:
push:
branches:
- master
tags:
- '*'
paths:
- VERSION
- .github/workflows/jenkins-image-publish.yaml
jobs:
build:
env:
image_name: enablement-jenkins
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Get image tags
id: image_tags
run: |
echo -n ::set-output name=IMAGE_TAGS::
# exposes variable VERSION
source VERSION
TAGS=('latest')
if [ "${VERSION}" ] && [ "${VERSION}" != "latest" ]; then
TAGS+=("${VERSION}")
fi
echo "${TAGS[*]}"
- name: Download s2i binary
run: |
curl -sL https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz | tar -xzf -
- name: Generate Dockerfile
run: |
./s2i build --as-dockerfile Dockerfile . quay.io/openshift/origin-jenkins:latest ${{ env.image_name }}:${{ steps.image_tags.outputs.IMAGE_TAGS }} --loglevel 1
- name: Build image
id: build_image
uses: redhat-actions/buildah-build@v2.6
with:
image: ${{ env.image_name }}
oci: true
tags: ${{ steps.image_tags.outputs.IMAGE_TAGS }}
dockerfiles: |
./Dockerfile
- name: Push to Quay
id: push_to_quay
uses: redhat-actions/push-to-registry@v2.1
with:
image: ${{ steps.build_image.outputs.image }}
registry: ${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
tags: ${{ steps.build_image.outputs.tags }}