|
| 1 | +name: operators-installer-sripts-runner-publish |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: '0 1 * * *' # everyday at 1am |
| 5 | + push: |
| 6 | + paths: |
| 7 | + - operators-installer-sripts-runner/version.json |
| 8 | + - .github/workflows/operators-installer-sripts-runner-publish.yaml |
| 9 | + |
| 10 | +# Declare default permissions as read only. |
| 11 | +permissions: read-all |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + env: |
| 16 | + context: operators-installer-sripts-runner |
| 17 | + image_name: operators-installer-sripts-runner |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + packages: write |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 |
| 23 | + |
| 24 | + - name: Get image tags |
| 25 | + id: image_tags |
| 26 | + uses: redhat-cop/github-actions/get-image-version@cc45c69b6655161f278271cd0c68ddcc1444a3f8 # v4.6 |
| 27 | + with: |
| 28 | + IMAGE_CONTEXT_DIR: ${{ env.context }} |
| 29 | + |
| 30 | + - name: Install qemu dependency |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y qemu-user-static |
| 34 | +
|
| 35 | + - name: Build image |
| 36 | + id: build_image |
| 37 | + uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 |
| 38 | + with: |
| 39 | + context: ${{ env.context }} |
| 40 | + dockerfiles: | |
| 41 | + ./${{ env.context }}/Dockerfile |
| 42 | + image: ${{ env.image_name }} |
| 43 | + platforms: linux/amd64 |
| 44 | + tags: "${{ steps.image_tags.outputs.IMAGE_TAGS }}" |
| 45 | + |
| 46 | + - name: Push to ghcr.io |
| 47 | + uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 |
| 48 | + if: ${{ !contains(github.ref, 'renovate') }} |
| 49 | + with: |
| 50 | + image: ${{ steps.build_image.outputs.image }} |
| 51 | + registry: ghcr.io/${{ github.repository }} |
| 52 | + username: ${{ github.repository_owner }} |
| 53 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + tags: ${{ steps.build_image.outputs.tags }} |
| 55 | + |
| 56 | + - name: Push to Quay |
| 57 | + env: |
| 58 | + REGISTRY_URI: ${{ secrets.REGISTRY_URI }} |
| 59 | + if: ${{ env.REGISTRY_URI != '' && !contains(github.ref, 'renovate') }} |
| 60 | + uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 |
| 61 | + with: |
| 62 | + image: ${{ steps.build_image.outputs.image }} |
| 63 | + registry: ${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }} |
| 64 | + username: ${{ secrets.REGISTRY_USERNAME }} |
| 65 | + password: ${{ secrets.REGISTRY_PASSWORD }} |
| 66 | + tags: ${{ steps.build_image.outputs.tags }} |
0 commit comments