Skip to content

Commit 879f34e

Browse files
committed
Add GitHub Action to build and push the container images
1 parent 392804c commit 879f34e

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build Container Images
2+
on:
3+
push:
4+
pull_request:
5+
schedule:
6+
- cron: 0 0 * * 0
7+
workflow_dispatch:
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
image:
14+
- provision-vm-service/check-task-complete
15+
- provision-vm-service/clone-template
16+
- provision-vm-service/list-providers
17+
- provision-vm-service/list-templates
18+
- provision-vm-service/power-on-vm
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Build image
22+
run: bin/build_image ${{ matrix.image }}
23+
- if: github.repository_owner == 'ManageIQ'
24+
name: Docker login
25+
run: echo ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | docker login docker.io --password-stdin --username ${{ secrets.DOCKER_REGISTRY_USERNAME }}
26+
- if: github.repository_owner == 'ManageIQ'
27+
name: Push container
28+
run: bin/push_image ${{ matrix.image }}

bin/build_image

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
IMAGE=$1
4+
if [ -z "$IMAGE" ]; then
5+
echo "Usage: $0 <image>"
6+
exit 1
7+
fi
8+
9+
if [ ! -f "$IMAGE/Dockerfile" ]; then
10+
echo "ERROR: Image $IMAGE does not exist"
11+
exit 1
12+
fi
13+
14+
cd "$IMAGE"
15+
16+
IMAGE="${IMAGE%/}"
17+
IMAGE="${IMAGE//\//-}"
18+
19+
docker build . -t "docker.io/manageiq/workflows-examples-$IMAGE:latest"

bin/push_image

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
IMAGE=$1
4+
if [ -z "$IMAGE" ]; then
5+
echo "Usage: $0 <image>"
6+
exit 1
7+
fi
8+
9+
if [ ! -f "$IMAGE/Dockerfile" ]; then
10+
echo "ERROR: Image $IMAGE does not exist"
11+
exit 1
12+
fi
13+
14+
cd "$IMAGE"
15+
16+
IMAGE="${IMAGE%/}"
17+
IMAGE="${IMAGE//\//-}"
18+
19+
docker push "docker.io/manageiq/workflows-examples-$IMAGE:latest"

0 commit comments

Comments
 (0)