Skip to content

Fix typos and output speedtest result to stdout #4

Fix typos and output speedtest result to stdout

Fix typos and output speedtest result to stdout #4

name: build-and-push-container-image
on:
pull_request:
types:
- closed
jobs:
build-and-push-container-image:
name: Build and push container image
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.action == 'closed' &&
(
contains(github.event.pull_request.labels.*.name, 'major') ||
contains(github.event.pull_request.labels.*.name, 'minor') ||
contains(github.event.pull_request.labels.*.name, 'patch')
) &&
!contains(github.event.pull_request.labels.*.name, 'chore')
steps:
- name: Checkout GIT repository
uses: actions/checkout@v3
- name: Get the application version
id: application-version
run: |
image_version=$(grep "^LABEL site.local.program.version=" Dockerfile | cut -d= -f2 | sed -e 's/"//g')
if [ -z "${image_version}" ]; then
echo "ERROR: unable to detect version number!" >&2
exit 1
fi
echo "tag=${image_version}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
context: .
platforms: linux/amd64, linux/arm64
tags: oitc/speedtest2mqtt:${{ steps.application-version.outputs.tag }},oitc/speedtest2mqtt:latest
labels: |
site.local.program.version=${{ steps.application-version.outputs.tag }}
context.github.repositoryUrl=${{ github.repositoryUrl }}
context.github.actor=${{ github.actor }}
context.github.event.repository.updated_at=${{ github.event.repository.updated_at}}
context.github.ref=${{ github.ref }}
context.github.job=${{ github.job }}
context.runner.os=${{ runner.os }}
context.runner.arch=${{ runner.arch }}