OSCI-6464 #227
Workflow file for this run
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/ciboard-server | |
IMAGE_REGISTRY_QUAY: quay.io/fedoraci/ciboard-server | |
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 "sha_long=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
build-args: | | |
GITCOMMIT=${{ steps.vars.outputs.sha_long }} | |
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 |