|
| 1 | +# Copyright (c) 2025, Zededa, Inc. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +--- |
| 4 | +name: Yetus image - build and publish on demand |
| 5 | +on: # yamllint disable-line rule:truthy |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + force: |
| 9 | + description: 'Force build even if no changes' |
| 10 | + type: boolean |
| 11 | + required: false |
| 12 | + default: false |
| 13 | + |
| 14 | + |
| 15 | +env: |
| 16 | + FORCE_BUILD: FORCE_BUILD=${{ inputs.force && '--force' || '' }} |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }} |
| 20 | + cancel-in-progress: true |
| 21 | + |
| 22 | +jobs: |
| 23 | + yetus-image: |
| 24 | + # Only run for the default branch |
| 25 | + if: github.ref_name == github.event.repository.default_branch |
| 26 | + runs-on: zededa-ubuntu-2204 |
| 27 | + env: |
| 28 | + HEAD_REF: ${{ github.event.pull_request.head.ref }} |
| 29 | + REPO_NAME: ${{ github.event.repository.full_name }} |
| 30 | + IMG_NAME: "renezededa/eve-yetus" |
| 31 | + IMG_TAG: "latest" |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Starting Report |
| 37 | + run: | |
| 38 | + echo Git Ref: "${HEAD_REF}" |
| 39 | + echo GitHub Event: ${{ github.event_name }} |
| 40 | + echo Disk usage |
| 41 | + df -h |
| 42 | + echo Memory |
| 43 | + free -m |
| 44 | + - name: Checkout |
| 45 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 46 | + with: |
| 47 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 48 | + ref: ${{ github.event.pull_request.head.ref }} |
| 49 | + fetch-depth: 0 |
| 50 | + persist-credentials: false |
| 51 | + - name: Login to Docker Hub |
| 52 | + if: ${{ env.REPO_NAME }} == 'rene/eve' |
| 53 | + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 |
| 54 | + with: |
| 55 | + username: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }} |
| 56 | + password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }} |
| 57 | + - name: Build and push Yetus image |
| 58 | + run: | |
| 59 | + docker buildx build --push --tag ${{ env.IMG_NAME }}:${{ env.IMG_TAG }} tools/yetus |
| 60 | + - name: Post package report |
| 61 | + run: | |
| 62 | + echo Disk usage |
| 63 | + df -h |
| 64 | + echo Memory |
| 65 | + free -m |
| 66 | + - name: Clean up |
| 67 | + run: | |
| 68 | + docker system prune -f -a || : |
| 69 | + docker rm -f $(docker ps -aq) && docker volume rm -f $(docker volume ls -q) || : |
0 commit comments