Skip to content

1.0.13_3

1.0.13_3 #187

Workflow file for this run

name: Docker
on:
push:
branches:
- '*'
tags:
- '*'
release:
types:
- published
pull_request_review:
types:
- submitted
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- if: github.event_name == 'release'
uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- if: github.event_name != 'release'
uses: actions/checkout@v7
- name: Resolve upstream ref
id: version
shell: bash
run: |
set -euo pipefail
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
raw_tag='${{ github.event.release.tag_name }}'
if [[ ! "${raw_tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(_[0-9]+)?$ ]]; then
echo "::error::Invalid release tag '${raw_tag}'. Expected vX.Y.Z or vX.Y.Z_N."
exit 1
fi
upstream_ref="${raw_tag%%_*}"
else
upstream_ref="master"
fi
echo "upstream_ref=${upstream_ref}" >> "${GITHUB_OUTPUT}"
- name: Verify upstream tag exists
if: github.event_name == 'release'
shell: bash
run: |
set -euo pipefail
if ! git ls-remote --exit-code --tags https://github.com/librespeed/speedtest-cli.git "refs/tags/${{ steps.version.outputs.upstream_ref }}" > /dev/null; then
echo "::error::Upstream tag '${{ steps.version.outputs.upstream_ref }}' not found."
exit 1
fi
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=match,pattern=v(.*),group=1
type=ref,event=branch
- uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
UPSTREAM_REF=${{ steps.version.outputs.upstream_ref }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
cache-to: type=inline
push: ${{ ((github.event_name == 'push' || github.event_name == 'workflow_run') && github.ref == 'refs/heads/master') || github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
auto-merge:
needs: build-and-push-image
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v5.0.0
with:
configuration-path: .github/auto_label.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: pascalgn/automerge-action@v0.16.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_LABELS: "automerge,!WIP,!do-not-merge"
MERGE_METHOD: squash