-
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.33 KB
/
CD.yml
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
# Upload to ghcr.io (:edge if on develop branch, :latest if on main branch)
name: CD
on:
# TODO: On test pass vs on push
push:
branches:
- main
- develop
env:
IMAGE_NAME: ghcr.io/vaagenim/piggy
IMAGE_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || 'edge' }}
PLATFORMS: linux/amd64,linux/arm64/v8
jobs:
build:
name: Release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# TODO: Ensure tests pass before building
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
driver: docker-container
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha