-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (57 loc) · 1.58 KB
/
docker-image.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
55
56
57
58
59
name: Build Docker Image
on:
workflow_run:
workflows: [ "tests" ]
branches: [ main ]
types: [ "completed" ]
push:
branches:
- main
- workflow
- workflowhub
- seek-1.11
- seek-1.12
- seek-1.13
- master-ibisba-demonstrator
- ruby-3
tags:
- "v*.*.*"
pull_request:
branches:
- main
jobs:
build:
name: "Build Image"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate Image Tags
id: generate-image-tags
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: Login to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.generate-image-tags.outputs.tags }}
labels: ${{ steps.generate-image-tags.outputs.labels }}