-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (56 loc) · 1.75 KB
/
build.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
name: Build and publish a Docker image
on:
push:
branches:
- "main"
tags: [ '*' ]
# - 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ main ]
jobs:
build:
name: Build & push docker image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./example-1-sidecars/Dockerfile
image: ghcr.io/Liquid-Reply/k8s-spin/spin-static-server
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug
run: |
echo "github.ref -> {{ github.ref }}"
- # Login into registry
name: Login to GitHub Container Registry
# if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- # Extract Docker metadata
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- # Build and push to GHCR Registry
name: Build and push Docker image
uses: docker/build-push-action@v5
with:
# context: .
push: ${{ github.event_name != 'pull_request' }}
file: ${{ matrix.dockerfile }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
# ghcr.io/${{ env.IMAGE_NAME }}:latest
# ghcr.io/${{ env.IMAGE_NAME }}:${{ github.sha }}
# ${{ steps.meta.outputs.tags }}