Automate production of CAPI VM images #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build CAPI image builder | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| IMAGE_NAME: image-builder | |
| REGISTRY: ghcr.io/elastisys | |
| jobs: | |
| build-image-builder: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: get tag | |
| id: get-tag | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| PR_TAG=$(echo "${PR_TITLE}" | sed -e 's/ /-/g') | |
| echo "TAG=${PR_TAG}-${{ github.sha }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "TAG=${GITHUB_REF##*/}-${{ github.sha }}" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: 'Login to GitHub Container Registry' | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{github.actor}} | |
| password: ${{secrets.GITHUB_TOKEN}} | |
| - name: run make docker-build | |
| run: make docker-build | |
| env: | |
| TAG: ${{ steps.get-tag.outputs.TAG }} | |
| - name: run make docker-push | |
| run: make docker-push | |
| env: | |
| TAG: ${{ steps.get-tag.outputs.TAG }} |