Skip to content

feat!: add spilo image (#16) #6

feat!: add spilo image (#16)

feat!: add spilo image (#16) #6

name: Release Image
on:
workflow_dispatch: {}
push:
branches:
- main
paths:
- .github/release-please/manifest.json
env:
REGISTRY: ghcr.io
jobs:
release_please:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
paths_released: ${{ steps.release.outputs.paths_released }}
steps:
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4
id: release
with:
skip-github-pull-request: true
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
release_image:
runs-on: ubuntu-latest
needs: release_please
if: ${{ needs.release_please.outputs.releases_created }}
strategy:
matrix:
image: ${{ fromJson(needs.release_please.outputs.paths_released) }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Detect changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
build:
- ${{ matrix.image }}/!(**.md)
- name: Get image name
env:
IMAGE: ${{ matrix.image }}
id: get-image-name
run: echo "fragment=${IMAGE##*/}" >> "$GITHUB_OUTPUT"
- name: Get image version
id: get-image-version
run: echo "version=$(jq -r '."${{ matrix.image }}"' < .github/release-please/manifest.json)" >> "$GITHUB_OUTPUT"
- name: Get image platform
id: get-image-platform
run: echo "platform=$(jq -r '."${{ matrix.image }}"' < .github/release-please/platform.json)" >> "$GITHUB_OUTPUT"
- name: Docker Metadata
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
id: meta
with:
images: ${{ format('{0}/{1}/{2}', env.REGISTRY ,'teutonet/oci-images', steps.get-image-name.outputs.fragment ) }}
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{ steps.get-image-version.outputs.version }}
type=sha,prefix=
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Login to GitHub Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: push
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
with:
context: ${{ matrix.image }}
platforms: ${{ steps.get-image-platform.outputs.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
abort:
runs-on: ubuntu-latest
needs: release_please
if: ${{ !needs.release_please.outputs.releases_created }}
steps:
- name: abort if no release was made
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}