Rhel gitlab (#244) #400
This file contains hidden or 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 | |
| IMAGE_REGISTRY_QUAY: quay.io/fedoraci/ciboard | |
| USER_QUAY: fedoraci+ciboard_github_ci | |
| name: Build and push image | |
| runs-on: ubuntu-latest | |
| 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_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Build Image | |
| id: build-image | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| extra-args: | | |
| --ulimit nofile=4096:4096 | |
| 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 |