Skip to content

v2.2.3

v2.2.3 #901

name: Madoc TS Docker
on:
push:
branches: ['main']
tags: ['v*']
pull_request:
branches: ['main', 'feature/v2.1']
paths:
- ".github/workflows/madoc-ts-docker.yaml"
- "services/madoc-ts/src/**"
- "services/madoc-ts/migrations/**"
- "services/madoc-ts/translations/**"
- "services/madoc-ts/schemas/**"
- "services/madoc-ts/themes/**"
- "services/madoc-ts/package.json"
- "services/madoc-ts/yarn.lock"
- "services/madoc-ts/Dockerfile"
- "services/madoc-ts/ecosystem.config.js"
- "services/madoc-ts/webpack.config.js"
- "services/madoc-ts/tsconfig.json"
jobs:
madoc-ts-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/digirati-co-uk/madoc-api
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push SHA to GitHub Packages
id: docker_build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: services/madoc-ts
push: ${{ github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_TIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Find Comment
uses: peter-evans/find-comment@v1
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Preview docker image available
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Preview docker image available
```
docker pull ghcr.io/digirati-co-uk/madoc-api:pr-${{github.event.pull_request.number}}
```
edit-mode: replace