Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .containerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
73 changes: 73 additions & 0 deletions .github/workflows/image-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Publish a container image

on:
push:
release:
types: [published, edited]

jobs:
build:
runs-on: ubuntu-24.04
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set the image metadata
run: ./build/set_image_metadata

- name: Set the operator version from the tag
if: (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'edited'))
run: |-
echo OPERATOR_VERSION=${{ github.event.release.tag_name }} >> "$GITHUB_ENV"

- name: Set the operator version from the tag
if: github.event_name == 'push'
run: |-
echo OPERATOR_VERSION=${{ github.sha }} >> "$GITHUB_ENV"

- name: Build an image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: db-operator-dev
tags: ${{ env.TAGS }}
platforms: linux/amd64, linux/arm64/v8
build-args: |
OPERATOR_VERSION=${{ env.OPERATOR_VERSION }}
containerfiles: |
./Containerfile
labels: ${{ env.ANNOTATIONS }}

- name: Push the image to GHCR
id: push-to-ghcr
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Set the version tag (only if released)
id: retag-version
if: (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'edited'))
run: |
buildah tag \
${{ steps.build-image.outputs.image }}:${{ github.sha }} \
ghcr.io/${{ github.repository_owner }}/db-operator:latest
buildah tag \
${{ steps.build-image.outputs.image }}:${{ github.sha }} \
ghcr.io/${{ github.repository_owner }}/db-operator:${{ github.event.release.tag_name }}

- name: Push the release image to GHCR
if: (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'edited'))
uses: redhat-actions/push-to-registry@v2
with:
tags: ghcr.io/${{ github.repository_owner }}/db-operator:latest ghcr.io/${{ github.repository_owner }}/db-operator:${{ github.event.release.tag_name }}
username: ${{ github.actor }}
password: ${{ github.token }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ target
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


# Added by cargo

/target
Loading
Loading