|
| 1 | +name: Publish Runner Image |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + images: |
| 7 | + type: string |
| 8 | + description: 'Images passed docker/metadata-action' |
| 9 | + required: true |
| 10 | + version: |
| 11 | + type: string |
| 12 | + description: Runner version (when empty the version set a containerfile is used) |
| 13 | + default: '' |
| 14 | + |
| 15 | + workflow_call: |
| 16 | + inputs: |
| 17 | + images: |
| 18 | + type: string |
| 19 | + description: 'Images passed docker/metadata-action' |
| 20 | + required: true |
| 21 | + version: |
| 22 | + type: string |
| 23 | + description: Runner version (when empty the version set a containerfile is used) |
| 24 | + default: '' |
| 25 | + |
| 26 | +jobs: |
| 27 | + build: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + contents: write |
| 31 | + packages: write |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout repository |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Runner Version |
| 38 | + id: runner |
| 39 | + run: | |
| 40 | + version="${{ inputs.version }}"; version="${version#v}" |
| 41 | + from_file="$(cat runners/podman.containerfile | |
| 42 | + sed -En '/ARG\s+RUNNER_VERSION/ { s/ARG\s+RUNNER_VERSION=//; p; }')" |
| 43 | + echo "version=${version:-$from_file}" >> $GITHUB_OUTPUT |
| 44 | +
|
| 45 | + - name: Rolling tag |
| 46 | + uses: bitdeps/rolling-tag@v1 |
| 47 | + id: roll |
| 48 | + with: |
| 49 | + version: ${{ steps.runner.outputs.version }} |
| 50 | + releases-only: false |
| 51 | + |
| 52 | + - name: Docker meta |
| 53 | + id: meta |
| 54 | + uses: docker/metadata-action@v5 |
| 55 | + with: |
| 56 | + images: ${{ github.event.inputs.images }} |
| 57 | + tags: | |
| 58 | + type=raw,value=${{ steps.roll.outputs.tag }} |
| 59 | + type=raw,value=${{ steps.roll.outputs.version }} |
| 60 | + type=raw,value=latest,enable=${{ steps.roll.outputs.updates-latest == 'true' }} |
| 61 | +
|
| 62 | + - name: Setup Docker buildx |
| 63 | + uses: docker/setup-buildx-action@v3 |
| 64 | + |
| 65 | + - name: Log into registry ${{ env.REGISTRY }} |
| 66 | + uses: docker/login-action@v3 |
| 67 | + with: |
| 68 | + registry: ${{ env.REGISTRY }} |
| 69 | + username: ${{ github.actor }} |
| 70 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + - name: Build and push Docker image |
| 73 | + id: build-and-push |
| 74 | + uses: docker/build-push-action@v5 |
| 75 | + with: |
| 76 | + file: runners/podman.containerfile |
| 77 | + context: ./runners |
| 78 | + push: true |
| 79 | + tags: ${{ steps.meta.outputs.tags }} |
| 80 | + labels: ${{ steps.meta.outputs.labels }} |
| 81 | + platforms: | |
| 82 | + linux/amd64 |
| 83 | + build-args: | |
| 84 | + RUNNER_VERSION=${{ steps.runner.outputs.version }} |
| 85 | +
|
| 86 | + - name: Create Tag |
| 87 | + uses: mathieudutour/github-tag-action@v6.2 |
| 88 | + with: |
| 89 | + custom_tag: ${{ steps.roll.outputs.tag }} |
0 commit comments