This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ubuntu-latest | |
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 }}" |