-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.34 KB
/
build-push-container.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
name: Use Podman to build and push container image to IBM Cloud Registry
on:
- push
env:
GITHUB_SHA: ${{ github.sha }}
jobs:
build-push-update:
name: Build image
runs-on: self-hosted
outputs:
image_url: ${{ steps.push-to-icr.outputs.registry-paths }}
steps:
- name: Clone the repository
uses: actions/checkout@v2
- name: Set short SHA
run: echo "SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ vars.REGISTRY_NAMESPACE }}/${{ vars.REGISTRY_IMAGE }}
tags: latest ${{ env.SHORT_SHA }}
containerfiles: |
./Dockerfile
- name: Log in to the IBM Cloud Container registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ vars.REGISTRY_ENDPOINT }}
username: iamapikey
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push to IBM Cloud Container Repository
id: push-to-icr
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ vars.REGISTRY_ENDPOINT }}
- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-icr.outputs.registry-paths }}"