Skip to content

Create 240308 - Rond - Mia-Platform - OSDAY Florence.pdf (#5) #47

Create 240308 - Rond - Mia-Platform - OSDAY Florence.pdf (#5)

Create 240308 - Rond - Mia-Platform - OSDAY Florence.pdf (#5) #47

name: Test and build 202211 KCD UK
on:
pull_request:
branches:
- workshops/202211-KCD-UK*
push:
branches:
- workshops/202211-KCD-UK*
- main
jobs:
tests:
name: Test with
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.8.0
- run: npm ci
working-directory: workshops/202211-KCD-UK/application
- run: npm test
working-directory: workshops/202211-KCD-UK/application
- run: npm run coverage
working-directory: workshops/202211-KCD-UK/application
build:
name: Build docker image
needs: tests
runs-on: ubuntu-latest
#if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Configure docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/rond-authz/workshops/2022-kcd-uk
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.documentation=https://rond-authz.io
org.opencontainers.image.vendor=rond authz
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare build cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./workshops/202211-KCD-UK/application
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}