-
Notifications
You must be signed in to change notification settings - Fork 187
71 lines (63 loc) · 2.07 KB
/
docker-publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: docker-publish
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
# TODO: Push to AWS CR at a later stage
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
driver-opts: >-
image=moby/buildkit:master
- name: Cache main image layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build And Push Image
- name: Build Docker image
run: docker compose -f docker-compose-build.yaml build
- name: Push Docker image
if: github.ref == 'refs/heads/master'
run: docker compose -f docker-compose-build.yaml push
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ failure() }}
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"workflow": "${{ github.workflow }}",
"action_name": "${{ github.action }}",
"ref": "${{ github.ref_name }}",
"actor": "${{ github.triggering_actor }}",
"event_name": "${{ github.event_name }}",
"run_id": "https://github.com/Layr-Labs/eigenda/actions/runs/${{ github.run_id }}",
"commit_sha": "https://github.com/Layr-Labs/eigenda/commit/${{ github.sha }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}