|
86 | 86 | # * DL3041 - Specify version with dnf install -y <package>-<version> |
87 | 87 | ignore: DL3041 |
88 | 88 | failure-threshold: warning |
89 | | - |
90 | | - image-build: |
91 | | - name: Container Image Build |
92 | | - needs: hadolint |
93 | | - runs-on: ubuntu-latest |
94 | | - env: |
95 | | - IMAGE_NAME: resultsdb |
96 | | - REGISTRY: quay.io/factory2 |
97 | | - GH_REGISTRY: ghcr.io/${{ github.actor }} |
98 | | - |
99 | | - steps: |
100 | | - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
101 | | - |
102 | | - - name: Set up Python ${{ matrix.python-version }} |
103 | | - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6 |
104 | | - with: |
105 | | - python-version: ${{ matrix.python-version }} |
106 | | - |
107 | | - - name: Install dependencies |
108 | | - run: | |
109 | | - python -m pip install --upgrade pip |
110 | | - pip install poetry podman-compose |
111 | | -
|
112 | | - - name: Update the Application Version |
113 | | - run: poetry version "$(./get-version.sh)" |
114 | | - |
115 | | - - name: Get image tag from git branch |
116 | | - id: get-image-tag |
117 | | - run: | |
118 | | - export TAG=$(sed 's/[^0-9a-zA-Z_.-]/__/g' <<< "$GITHUB_REF_NAME") && |
119 | | - echo "::set-output name=tag::$TAG" |
120 | | -
|
121 | | - - name: Build Image |
122 | | - id: build-image |
123 | | - uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 |
124 | | - with: |
125 | | - image: ${{ env.IMAGE_NAME }} |
126 | | - tags: >- |
127 | | - ${{ steps.get-image-tag.outputs.tag }} |
128 | | - ${{ github.ref == 'refs/heads/develop' && 'latest' || '' }} |
129 | | - ${{ github.sha }} |
130 | | - containerfiles: Dockerfile |
131 | | - build-args: | |
132 | | - GITHUB_SHA=${{ github.sha }} |
133 | | - EXPIRES_AFTER=${{ github.ref == 'refs/heads/develop' && 'never' || '30d' }} |
134 | | -
|
135 | | - - name: Log in to the image registry |
136 | | - if: github.event_name == 'push' && github.actor != 'dependabot[bot]' |
137 | | - uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1 |
138 | | - with: |
139 | | - registry: ${{ secrets.REGISTRY_USER && env.REGISTRY || env.GH_REGISTRY }} |
140 | | - username: ${{ secrets.REGISTRY_USER || github.actor }} |
141 | | - password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} |
142 | | - |
143 | | - - name: Push Image |
144 | | - if: github.event_name == 'push' && github.actor != 'dependabot[bot]' |
145 | | - uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 |
146 | | - with: |
147 | | - image: ${{ steps.build-image.outputs.image }} |
148 | | - tags: ${{ steps.build-image.outputs.tags }} |
149 | | - registry: ${{ secrets.REGISTRY_USER && env.REGISTRY || env.GH_REGISTRY }} |
0 commit comments