-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.41 KB
/
build-push-dev.yml
File metadata and controls
49 lines (41 loc) · 1.41 KB
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
name: Build and Push to GHCR
on:
workflow_run:
workflows: ["Run Tests"]
types:
- completed
branches: [ develop ]
jobs:
build-push:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT_TOKEN }}
- name: Convert to lowercase
id: string
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: memory-infra/docker/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/${{ steps.string.outputs.lowercase }}/memory-app:${{ github.sha }}
${{ github.ref == 'refs/heads/main' && format('ghcr.io/{0}/memory-app:latest', steps.string.outputs.lowercase) || format('ghcr.io/{0}/memory-app:dev', steps.string.outputs.lowercase) }}