Skip to content

Commit 4a422e4

Browse files
sjmonsonmarkurtz
andauthored
Add container build jobs to all build workflows (#190)
Add container build jobs alongside the existing wheel jobs. Tag containers based on which workflow was triggered. Tags: * PR: `pr-{{ github.event.number }}` ~`{{ github.sha }}`~ * Nightly: `nightly` ~`{{ github.sha }}`~ * Release candidate: `latest` ~`{{ github.sha }}`~ * Release: `latest` `stable` ~`{{ github.sha }}`~ Edit: To save space, don't use unique tags. - - - ## Future Improvements (Follow up PR) * Tag RC and releases with their versions. (e.g. 0.3.0-rc, 0.3.0) * Reuse wheel builds in container --------- Co-authored-by: Mark Kurtz <mark.j.kurtz@gmail.com>
1 parent d74ff21 commit 4a422e4

File tree

4 files changed

+99
-0
lines changed

4 files changed

+99
-0
lines changed

.github/workflows/development.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,28 @@ jobs:
224224
They will be retained for **up to 30 days**.
225225
`
226226
})
227+
228+
build-and-push-container:
229+
runs-on: ubuntu-latest
230+
permissions:
231+
packages: write
232+
steps:
233+
- name: Checkout
234+
uses: actions/checkout@v4
235+
- name: Buildah build
236+
id: build-image
237+
uses: redhat-actions/buildah-build@v2
238+
with:
239+
image: ${{ github.event.repository.name }}
240+
tags: "pr-${{ github.event.number }}"
241+
containerfiles: |
242+
./deploy/Containerfile
243+
- name: Push To ghcr.io
244+
id: push-to-ghcr
245+
uses: redhat-actions/push-to-registry@v2
246+
with:
247+
image: ${{ steps.build-image.outputs.image }}
248+
tags: ${{ steps.build-image.outputs.tags }}
249+
username: ${{ github.actor }}
250+
password: ${{ github.token }}
251+
registry: ghcr.io/${{ github.repository_owner }}

.github/workflows/nightly.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,27 @@ jobs:
123123
- name: Log artifact location
124124
run: |
125125
echo "Artifacts uploaded to: ${{ steps.artifact-upload.outputs.artifact-url }}"
126+
127+
build-and-push-container:
128+
needs: [unit-tests, integration-tests, e2e-tests]
129+
runs-on: ubuntu-latest
130+
steps:
131+
- name: Checkout
132+
uses: actions/checkout@v4
133+
- name: Buildah build
134+
id: build-image
135+
uses: redhat-actions/buildah-build@v2
136+
with:
137+
image: ${{ github.event.repository.name }}
138+
tags: nightly
139+
containerfiles: |
140+
./deploy/Containerfile
141+
- name: Push To ghcr.io
142+
id: push-to-ghcr
143+
uses: redhat-actions/push-to-registry@v2
144+
with:
145+
image: ${{ steps.build-image.outputs.image }}
146+
tags: ${{ steps.build-image.outputs.tags }}
147+
username: ${{ github.actor }}
148+
password: ${{ github.token }}
149+
registry: ghcr.io/${{ github.repository_owner }}

.github/workflows/release-candidate.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,28 @@ jobs:
115115
username: ${{ secrets.PYPI_PUBLIC_USER }}
116116
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
117117
whl: $(find dist -name '*.tar.gz')
118+
119+
build-and-push-container:
120+
needs: [unit-tests, integration-tests, e2e-tests]
121+
runs-on: ubuntu-latest
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v4
125+
- name: Buildah build
126+
id: build-image
127+
uses: redhat-actions/buildah-build@v2
128+
with:
129+
image: ${{ github.event.repository.name }}
130+
# TODO: Tag version
131+
tags: latest
132+
containerfiles: |
133+
./deploy/Containerfile
134+
- name: Push To ghcr.io
135+
id: push-to-ghcr
136+
uses: redhat-actions/push-to-registry@v2
137+
with:
138+
image: ${{ steps.build-image.outputs.image }}
139+
tags: ${{ steps.build-image.outputs.tags }}
140+
username: ${{ github.actor }}
141+
password: ${{ github.token }}
142+
registry: ghcr.io/${{ github.repository_owner }}

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,28 @@ jobs:
114114
run: pip install tox
115115
- name: Run end-to-end tests
116116
run: tox -e test-e2e
117+
118+
build-and-push-container:
119+
needs: [unit-tests, integration-tests, e2e-tests]
120+
runs-on: ubuntu-latest
121+
steps:
122+
- name: Checkout
123+
uses: actions/checkout@v4
124+
- name: Buildah build
125+
id: build-image
126+
uses: redhat-actions/buildah-build@v2
127+
with:
128+
image: ${{ github.event.repository.name }}
129+
# TODO: Tag version
130+
tags: latest stable
131+
containerfiles: |
132+
./deploy/Containerfile
133+
- name: Push To ghcr.io
134+
id: push-to-ghcr
135+
uses: redhat-actions/push-to-registry@v2
136+
with:
137+
image: ${{ steps.build-image.outputs.image }}
138+
tags: ${{ steps.build-image.outputs.tags }}
139+
username: ${{ github.actor }}
140+
password: ${{ github.token }}
141+
registry: ghcr.io/${{ github.repository_owner }}

0 commit comments

Comments
 (0)