From 031ea5e9cc6c365852e9ca527109caeba2de016d Mon Sep 17 00:00:00 2001 From: Anjan Nath Date: Thu, 28 Nov 2024 17:28:15 +0530 Subject: [PATCH] ci: build image for self hosted gh runner test this workflow uses path filters and runs only when files related to self hosted runner code changes it then triggers the workflow for the self hosted runner test, making the workflow run only for file changes in the self hosted runner modules --- .../workflows/build-img-ghrunner-test.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/build-img-ghrunner-test.yaml diff --git a/.github/workflows/build-img-ghrunner-test.yaml b/.github/workflows/build-img-ghrunner-test.yaml new file mode 100644 index 00000000..2c024f31 --- /dev/null +++ b/.github/workflows/build-img-ghrunner-test.yaml @@ -0,0 +1,50 @@ +name: build-img-ghrunner-test + +on: + push: + branches: [ main ] + tags: + - '*' + paths: + - 'pkg/util/ghactions/*.go' + - '.github/workflows/build-img-ghrunner-test.yaml' + pull_request: + branches: [ main ] + paths: + - 'pkg/util/ghactions/*.go' + - '.github/workflows/build-img-ghrunner-test.yaml' + +jobs: + build-mapt: + name: build-mapt + runs-on: ubuntu-24.04 + steps: + - name: Prepare runner + shell: bash + run: | + sudo apt-get update && sudo apt-get install -y qemu-user-static + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build image for PR + if: ${{ github.event_name == 'pull_request' }} + env: + IMG: ghcr.io/redhat-developer/mapt-img-ghrunner-test:pr-${{ github.event.number }} + shell: bash + run: | + make oci-build + make oci-save + echo ${IMG} > mapt-image + + - name: Create image metadata + run: | + echo ${{ github.event_name }} > mapt-event + cat ./mapt-event + + - name: Upload crc-builder + uses: actions/upload-artifact@v4 + with: + name: mapt + path: mapt* +