Skip to content

build wdi5 docker images #53

build wdi5 docker images

build wdi5 docker images #53

name: build wdi5 docker images
# only run after wdi5/wdio-ui5-service package was released
on:
workflow_run:
workflows: [build and publish wdi5 as wdio-ui5-service to npm]
types:
- completed
# on:
# push:
# branches:
# - main
# paths:
# # relevant
# - "client-side-js/**"
# - "docker/**"
# - "examples/**"
# - "scripts/**"
# - "src/**"
# # don't run on changes to these
# - "!.husky/**"
# - "!.vscode/**"
# - "!docs/**"
# - "!.*"
# - "!*.md"
# - "!*.cjs"
# - "!test/**/*"
jobs:
build:
# only run if building and publishing was successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
node_version: [16, 18, 19, 20]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- uses: actions/checkout@v3
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Log in to gh packages registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/wdi5
tags: |
type=semver,pattern={{version}},value=${{ steps.package-version.outputs.current-version}}
type=raw,value=node${{ matrix.node_version }}
# - name: show tags + labels
# run: |
# echo ${{ steps.meta.outputs.tags }}
# echo ${{ steps.meta.outputs.labels }}
- name: Build and push wdi5 docker image for node${{ matrix.node_version }}
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.standalone
build-args: node_version=${{ matrix.node_version }}
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/wdi5:${{ steps.package-version.outputs.current-version}}-node${{ matrix.node_version }}
# tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}