commit: d7e9b1ab0b92cc81c0cc6c589e713c78e8b8df2b
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 14 17:19:46 2023 +0000
Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Sat Oct 14 17:19:46 2023 +0000
URL: https://gitweb.gentoo.org/proj/docker-images.git/commit/?id=d7e9b1ab
split iamge build steps into dedicated actions file
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
.github/actions/container_build/action.yml | 46 ++++++++++++++++++++++++++++++
.github/workflows/build.yml | 32 ++++-----------------
2 files changed, 51 insertions(+), 27 deletions(-)
diff --git a/.github/actions/container_build/action.yml
b/.github/actions/container_build/action.yml
new file mode 100644
index 0000000..bef1441
--- /dev/null
+++ b/.github/actions/container_build/action.yml
@@ -0,0 +1,46 @@
+---
+name: Build
+inputs:
+ target:
+ required: true
+ dockerhub_username:
+ required: true
+ dockerhub_password:
+ required: true
+runs:
+ using: composite
+ steps:
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v2
+ - name: Set up buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Set up TARGET
+ run: echo "TARGET=${{ inputs.target }}" | tee $GITHUB_ENV
+ shell: bash
+ - name: Build image
+ if: startswith(inputs.target, 'stage3') || startswith(inputs.target,
'portage')
+ shell: bash
+ run: ./build.sh
+ - name: Build python image
+ if: startswith(inputs.target, 'python')
+ shell: bash
+ run: ./build-python.sh
+ - name: Inspect image
+ shell: bash
+ run: docker image inspect "${ORG}/${TARGET/-/:}"
+ - name: Inspect portage
+ if: matrix.target != 'portage'
+ shell: bash
+ run: docker run --rm "${ORG}/${TARGET/-/:}" emerge --info
+ - name: Login to DockerHub
+ uses: docker/login-action@v2
+ if: github.event_name == 'schedule'
+ with:
+ username: ${{ inputs.dockerhub_username }}
+ password: ${{ inputs.dockerhub_password }}
+ - name: Push image
+ if: github.event_name == 'schedule'
+ shell: bash
+ env:
+ DOCKER_CLI_EXPERIMENTAL: enabled
+ run: ./deploy.sh
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef4e56f..cb95b19 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -58,34 +58,12 @@ jobs:
- stage3-s390x-systemd
name: ${{ matrix.target }}
runs-on: ubuntu-latest
- env:
- TARGET: ${{ matrix.target }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v2
- - name: Set up buildx
- uses: docker/setup-buildx-action@v2
- - name: Build image
- if: startswith(matrix.target, 'stage3') || startswith(matrix.target,
'portage')
- run: ./build.sh
- - name: Build python image
- if: startswith( matrix.target, 'python')
- run: ./build-python.sh
- - name: Inspect image
- run: docker image inspect "${ORG}/${TARGET/-/:}"
- - name: Inspect portage
- if: matrix.target != 'portage'
- run: docker run --rm "${ORG}/${TARGET/-/:}" emerge --info
- - name: Login to DockerHub
- uses: docker/login-action@v2
- if: github.event_name == 'schedule'
+ - name: Build ${{ matrix.target }}
+ uses: ./.github/actions/container_build
with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_PASSWORD }}
- - name: Push image
- if: github.event_name == 'schedule'
- env:
- DOCKER_CLI_EXPERIMENTAL: enabled
- run: ./deploy.sh
+ target: ${{ matrix.target }}
+ dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
+ dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}