Skip to content

Merge pull request #51 from digirati-co-uk/feature/UALS-29-random-ord… #21

Merge pull request #51 from digirati-co-uk/feature/UALS-29-random-ord…

Merge pull request #51 from digirati-co-uk/feature/UALS-29-random-ord… #21

Workflow file for this run

name: Docker image
on:
push:
branches: ['main', 'ual_main']
tags: ['v*']
pull_request:
branches: ['main', 'ual_main']
paths:
- ".github/workflows/docker.yaml"
- "search_service/**"
- "Dockerfile"
- "entrypoint"
- "nginx.conf"
- "requirements.txt"
jobs:
madoc-search-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-search-service
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 }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- 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'
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'
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-search-service:pr-${{github.event.pull_request.number}}
```
edit-mode: replace