|
| 1 | +name: Build Foreman OpenBolt Plugin |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout foreman-packaging |
| 11 | + uses: actions/checkout@v4 |
| 12 | + with: |
| 13 | + repository: theforeman/foreman-packaging |
| 14 | + path: foreman-packaging |
| 15 | + ref: 'rpm/3.15' |
| 16 | + |
| 17 | + - name: Checkout foreman_openbolt |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + path: foreman_openbolt |
| 21 | + |
| 22 | + - name: Set up Docker Buildx |
| 23 | + uses: docker/setup-buildx-action@v3 |
| 24 | + |
| 25 | + - name: Build foreman-packaging container |
| 26 | + uses: docker/build-push-action@v5 |
| 27 | + with: |
| 28 | + context: ./foreman-packaging |
| 29 | + file: ./foreman-packaging/Containerfile |
| 30 | + tags: foreman-packaging:latest |
| 31 | + load: true |
| 32 | + cache-from: type=gha |
| 33 | + cache-to: type=gha,mode=max |
| 34 | + |
| 35 | + - name: Run foreman-packaging container |
| 36 | + run: | |
| 37 | + docker run -d --name foreman-packaging --privileged \ |
| 38 | + -v "${{ github.workspace }}/foreman-packaging":/opt/foreman-packaging \ |
| 39 | + -v "${{ github.workspace }}/foreman_openbolt":/foreman_bolt \ |
| 40 | + foreman-packaging /bin/sh -c 'tail -f /dev/null' |
| 41 | +
|
| 42 | + - name: Install dependencies in container |
| 43 | + run: | |
| 44 | + docker exec foreman-packaging /bin/sh -c 'dnf install -y epel-release glibc-langpack-en' |
| 45 | + docker exec foreman-packaging /bin/sh -c 'dnf install -y https://yum.theforeman.org/releases/3.15/el9/x86_64/foreman-release.rpm' |
| 46 | + docker exec foreman-packaging /bin/sh -c 'dnf install -y rubygems-devel foreman-plugin foreman-assets rpmdevtools rpm-build mock' |
| 47 | +
|
| 48 | + - name: Build foreman_openbolt RPM |
| 49 | + run: docker exec -w /foreman_bolt foreman-packaging /bin/sh -c './build-rpm' |
| 50 | + |
| 51 | + - name: Stop and remove foreman-packaging container |
| 52 | + run: | |
| 53 | + docker stop foreman-packaging |
| 54 | + docker rm foreman-packaging |
| 55 | +
|
| 56 | + - name: Upload build artifact |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: build-artifacts-foreman_openbolt |
| 60 | + path: "*.rpm" |
0 commit comments