Skip to content

Publish

Publish #14

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Publish
# Controls when the workflow will run
on:
release:
types: [ published ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
registry_name: ghcr.io
image_name: iothub-portal
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: Build & Push Solution
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4.1.2
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
- name: Docker Login to ACR
# You may pin to the exact commit or the version.
uses: docker/login-action@v3.1.0
with:
registry: ${{ env.registry_name }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.registry_name }}/${{ github.repository_owner }}/${{ env.image_name }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
flavor: |
latest=true
- name: Build and push
# You may pin to the exact commit or the version.
uses: docker/build-push-action@v5.3.0
with:
# Build's context is the set of files located in the specified PATH or URL
context: src/
# Push is a shorthand for --output=type=registry
push: true
build-args: |
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
GITHUB_RUN_NUMBER=${{ github.run_number }}
tags:
${{ steps.meta.outputs.tags }}