fix: no need to check #89
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: Build | |
on: | |
push: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
#we totally ignore the docker tag in the Dockerfile, since the autoupgrader may be skipping version | |
- name: Fetch recent tags from source | |
id: fetch_source_tags | |
run: | | |
curl -s "https://hub.docker.com/v2/repositories/bitnami/mariadb/tags/?page_size=100" | \ | |
jq -r '.results | sort_by(.last_updated) | reverse | map(select(.name | test("^[0-9]+\\.[0-9]+\\.[0-9]+-debian-12"))) | .[].name' > source_tags.txt | |
- name: Fetch destination tags | |
id: fetch_dest_tags | |
run: | | |
curl -s "https://hub.docker.com/v2/repositories/catglobe/mariadb/tags/?page_size=100" | \ | |
jq -r '.results[].name' > dest_tags.txt | |
- name: Show fetched source tags | |
run: | | |
echo "Source tags fetched:" | |
cat source_tags.txt | |
echo "Destination tags fetched:" | |
cat dest_tags.txt | |
if [ ! -s source_tags.txt ]; then | |
echo "No tags matching debian-12 found, skipping build." | |
exit 0 | |
fi | |
- name: Build and Push Missing Tags | |
run: | | |
missing_tags=$(comm -23 <(sort source_tags.txt) <(sort dest_tags.txt)) | |
for tag in $missing_tags; do | |
echo "Updating Dockerfile with tag: $tag" | |
sed -i "s|^FROM bitnami/mariadb:.*|FROM bitnami/mariadb:$tag|" Dockerfile | |
echo "Building and pushing tag: $tag" | |
docker build --platform linux/amd64,linux/arm64 \ | |
--tag ${{ secrets.DOCKER_USERNAME }}/mariadb:$tag \ | |
--push . | |
done | |