Skip to content

Commit

Permalink
inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
timbmg committed Nov 26, 2022
1 parent 6804515 commit 8dac06c
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and Deploy

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
service: [
"timbmg/acl-search-frontend",
"timbmg/acl-search-index",
"timbmg/acl-search"
]
include:
- service: "timbmg/acl-search-frontend"
context: "frontend"
- service: "timbmg/acl-search-index"
context: "index"
- service: "timbmg/acl-search"
context: "search"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.service }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.service }}-
${{ runner.os }}-buildx-
- name: Build deployable image
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: ${{ matrix.context }}
target: build
build-args: ${{ matrix.build-args }}
push: true
tags: |
ukpsquare/${{ matrix.service }}:${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deployment
uses: distributhor/workflow-webhook@v2
env:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}
data: '{"sha": "${{ github.sha }}"}'
verify_ssl: false

0 comments on commit 8dac06c

Please sign in to comment.