garo-gnm1d-moxa: v1.0.1 #2
Workflow file for this run
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
# Inspiration | |
# https://github.com/actions/starter-workflows/blob/main/ci/docker-publish.yml | |
name: Build Docker image | |
on: | |
workflow_dispatch: | |
inputs: | |
tags: | |
description: 'Test scenario tags' | |
required: false | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# - name: Send job status to MQTT (starting job) | |
# uses: potaesm/[email protected] | |
# if: always() | |
# env: | |
# JOB_CONCLUSION: ${{ job.status }} | |
# NODE_VERSION: ${{ matrix.node }} | |
# with: | |
# url: ${{ secrets.PUBLIC_MQTT_BROKER_URL }} | |
# topic: control/github_actions_action_runner | |
# payload: '{ "type":"ci-test", "repo": "${{ github.repository }}", "job": "${{ github.job }}", "workflow": "${{ github.workflow }}", "nodeVersion": "${{ env.NODE_VERSION }}","status": "in_progress","conclusion":"${{ env.JOB_CONCLUSION }}" }' | |
# username: ${{ secrets.PUBLIC_MQTT_BROKER_USER }} | |
# connectTimeout: 30000 | |
- name: Show input values | |
run: | | |
echo "Inputs: ${{ github.event.inputs }}" | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
# Login against a Docker registry except on PR | |
# https://github.com/marketplace/actions/docker-login | |
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Create clean tag for Docker | |
run: | | |
export TAGTMP1=${{ github.ref }} | |
echo "TAG=$(echo "${TAGTMP1##*-}")" >> $GITHUB_ENV | |
- name: Dump GitHub context | |
if: always() | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Dump job context | |
if: always() | |
env: | |
JOB_CONTEXT: ${{ toJSON(job) }} | |
run: echo "$JOB_CONTEXT" | |
- name: Dump steps context | |
if: always() | |
env: | |
STEPS_CONTEXT: ${{ toJSON(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Dump runner context | |
if: always() | |
env: | |
RUNNER_CONTEXT: ${{ toJSON(runner) }} | |
run: echo "$RUNNER_CONTEXT" | |
- name: Dump strategy context | |
if: always() | |
env: | |
STRATEGY_CONTEXT: ${{ toJSON(strategy) }} | |
run: echo "$STRATEGY_CONTEXT" | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/marketplace/actions/docker-metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
with: | |
# images: ${{ env.IMAGE_NAME }} | |
images: ${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}},value=${{ env.TAG }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ env.TAG }} | |
type=semver,pattern={{major}},value=${{ env.TAG }} | |
- name: Show Docker tags that will be used | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
run: echo '${{ steps.meta.outputs.tags }}' | |
- name: Show Docker labels that will be used | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
run: echo '${{ steps.meta.outputs.labels }}' | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
with: | |
# context: ./src | |
context: . | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
linux/arm/v7 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Image digest | |
if: | | |
github.event_name != 'pull_request' | |
# && github.repository_owner == 'mountaindude' | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
# - name: Send job status to MQTT when done | |
# uses: potaesm/[email protected] | |
# if: always() | |
# env: | |
# JOB_STATUS: ${{ job.status }} | |
# with: | |
# url: ${{ secrets.PUBLIC_MQTT_BROKER_URL }} | |
# topic: control/github_actions_action_runner | |
# payload: '{ "type":"docker-build", "repo": "${{ github.repository }}", "job": "${{ github.job }}", "workflow": "${{ github.workflow }}","status": "completed","conclusion":"${{ env.JOB_STATUS }}" }' | |
# username: ${{ secrets.PUBLIC_MQTT_BROKER_USER }} | |
# connectTimeout: 30000 |