wip #102
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: Build and Push Image | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
- feature-* | |
jobs: | |
login-build-push: | |
env: | |
IMAGE_REGISTRY_GITHUB: ghcr.io/fedora-ci/kaijs | |
IMAGE_REGISTRY_QUAY: quay.io/fedoraci/kaijs | |
USER_QUAY: fedoraci+ciboard_github_ci | |
name: Build and push image | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Log in to the GitHub Container registry | |
uses: redhat-actions/podman-login@v1 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY_GITHUB }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to Quay.io | |
uses: redhat-actions/podman-login@v1 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY_QUAY }} | |
username: ${{ env.USER_QUAY }} | |
password: ${{ secrets.PASSWORD_QUAY }} | |
- uses: actions/checkout@v3 | |
- name: Set outputs | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
tags: | | |
${{ env.IMAGE_REGISTRY_GITHUB }}:${{ steps.vars.outputs.sha_short }} | |
${{ ( github.ref == 'refs/heads/main' && format('{0}:latest', env.IMAGE_REGISTRY_GITHUB) ) || '' }} | |
${{ ( github.ref_type == 'tag' && format('{0}:{1}', env.IMAGE_REGISTRY_GITHUB, github.ref_name) ) || '' }} | |
${{ env.IMAGE_REGISTRY_QUAY }}:${{ steps.vars.outputs.sha_short }} | |
${{ ( github.ref == 'refs/heads/main' && format('{0}:latest', env.IMAGE_REGISTRY_QUAY) ) || '' }} | |
${{ ( github.ref_type == 'tag' && format('{0}:{1}', env.IMAGE_REGISTRY_QUAY, github.ref_name) ) || '' }} | |
containerfiles: | | |
./Dockerfile | |
- name: Push to Repositories | |
id: push-to-repo | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
- name: Print image url | |
run: echo "Image pushed to ${{ steps.push-to-repo.outputs.registry-paths }}" | |
# vim: noai:ts=2:sw=2 et |