Skip to content

Auto-update sbcl

Auto-update sbcl #73

name: Build new images
on:
pull_request:
branches:
- master
types:
- closed
jobs:
updated:
name: Check new versions
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
outputs:
versions: ${{ steps.extract-diff.outputs.versions }}
images: ${{ steps.extract-diff.outputs.images }}
steps:
- id: extract-diff
run: |
PR_FILES_URL="https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/${{ github.event.number }}/files"
VERSIONS=$(curl -s "$PR_FILES_URL" \
| jq -rcM 'map(select(.filename | test("[^/]+/versions$")) | {(.filename | match("[^/]+") | .string): (.patch | split("\n") | map(select(. | test("^\\+")) | .[1:] | match("[^,]+") | .string))}) | add')
echo "::set-output name=versions::$VERSIONS"
echo "::set-output name=images::$(echo "$VERSIONS" | jq -Mc 'to_entries | map(.key)')"
build_images:
name: Build ${{ matrix.target }}
needs: updated
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
strategy:
matrix:
target: ${{ fromJSON(needs.updated.outputs.images) }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v8.1.5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: fukamachi
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and publish image
env:
IMAGE: ${{ matrix.target }}
ARCH: linux/amd64,linux/arm64
run: |
VERSIONS=($(echo '${{ needs.updated.outputs.versions }}' | jq -rc ".$IMAGE" | tr -d '[]"' | sed -e 's/,/ /g'))
OS=("debian" "ubuntu" "alpine")
for version in "${VERSIONS[@]}"; do
for os in "${OS[@]}"; do
if [ "$os" == "alpine" ]; then
ARCH=linux/amd64
fi
BUILD_ARGS=--push ARCH="$ARCH" ./build.sh "$IMAGE" "$version" "$os"
done
done