Find & build recent Alpine-based Asterisk images #393
This file contains 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: Find & build recent Alpine-based Asterisk images | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- .github/workflows/find-alpine-tags.yml | |
- "alpine/*" | |
schedule: | |
# ┌───────────── minute (0 - 59) | |
# │ ┌───────────── hour (0 - 23) | |
# │ │ ┌───────────── day of the month (1 - 31) | |
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# * * * * * | |
- cron: '0 19 1-7,15-21 * 3' # first and third wednesdays of the month | |
jobs: | |
tags: | |
name: Discover Alpine linux docker tags | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
alpine: ${{ steps.tags.outputs.alpine }} | |
alpine-glibc: ${{ steps.tags.outputs.alpine-glibc }} | |
steps: | |
- name: Set dynamic matrix | |
id: tags | |
shell: bash | |
run: | | |
set -ueo pipefail | |
TOKEN_URI="https://auth.docker.io/token" | |
LIST_URI="https://registry-1.docker.io/v2/###IMAGE###/tags/list" | |
IMAGE='library/alpine' | |
IMAGE_GLIBC='frolvlad/alpine-glibc' | |
SCOPE="scope=repository:${IMAGE}:pull&scope=repository:${IMAGE_GLIBC}:pull&" | |
TOKEN=$(curl -Ss "${TOKEN_URI}?service=registry.docker.io&${SCOPE}" | jq -r .token) | |
ALPINE_RELEASES="$( | |
( | |
THIS_URI=$(echo -n "${LIST_URI}" | sed -e "s^###IMAGE###^${IMAGE}^") | |
curl -SsL \ | |
-H "Accept: application/json" \ | |
-H "Authorization: Bearer $TOKEN" "${THIS_URI}" \ | |
| jq -M -r '.tags[]' \ | |
| grep -P '^[3]\.\d+$' \ | |
| sort \ | |
| sort --stable --field-separator='.' --key=1,1n --key=2,2n | |
echo "latest" | |
echo "edge" | |
) \ | |
| sed -re "s/^/alpine:/g" | |
)" | |
ALPINE_GLIBC_RELEASES="$( | |
( | |
THIS_URI=$(echo -n "${LIST_URI}" | sed -e "s^###IMAGE###^${IMAGE_GLIBC}^") | |
curl -Ss \ | |
-H "Accept: application/json" \ | |
-H "Authorization: Bearer $TOKEN" "${THIS_URI}" \ | |
| jq -M -r '.tags[]' \ | |
| grep -P '^alpine-[3]\.\d+$' \ | |
| sort --field-separator='-' --key=1,1n \ | |
| sort --stable --field-separator='.' --key=1,1n --key=2,2n | |
echo "latest" | |
echo "edge" | |
) \ | |
| sed -re "s/^/frolvlad\/alpine-glibc:/g" | |
)" | |
JSON_MATRIX_ALPINE="$( | |
echo -n "$ALPINE_RELEASES" \ | |
| tr '\n' ' ' \ | |
| jq --slurp -c -R 'split(" ") | map({run: .}) | {include: .}' | |
)" | |
echo "::set-output name=alpine::${JSON_MATRIX_ALPINE}" | |
JSON_MATRIX_ALPINE_GLIBC="$( | |
echo -n "$ALPINE_GLIBC_RELEASES" \ | |
| tr '\n' ' ' \ | |
| jq --slurp -c -R 'split(" ") | map({run: .}) | {include: .}' | |
)" | |
echo "::set-output name=alpine-glibc::${JSON_MATRIX_ALPINE_GLIBC}" | |
echo "Continue to generate Asterisk images for alpine linux:" | |
echo "======================================================" | |
echo -e "$ALPINE_RELEASES" | |
echo | |
echo "and:" | |
echo -e "$ALPINE_GLIBC_RELEASES" | |
echo | |
echo | |
echo "JSON payload:" | |
echo "==================================================" | |
echo "$JSON_MATRIX_ALPINE" | jq | |
echo | |
echo "and" | |
echo "$JSON_MATRIX_ALPINE_GLIBC" | jq | |
generate-alpine-images: | |
needs: tags | |
uses: ./.github/workflows/build-alpine-images.yml | |
with: | |
docker-tags: ${{ needs.tags.outputs.alpine }} | |
secrets: | |
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} | |
generate-alpine-glibc-images: | |
needs: tags | |
uses: ./.github/workflows/build-alpine-images.yml | |
with: | |
docker-tags: ${{ needs.tags.outputs.alpine-glibc }} | |
secrets: | |
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} |