-
Notifications
You must be signed in to change notification settings - Fork 8
76 lines (66 loc) · 2.15 KB
/
publish-docker.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
72
73
74
75
76
name: Publish Docker
on:
release:
types:
- published
concurrency: release
env:
REGISTRY: ghcr.io
jobs:
publish-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- name: Insights Explorer
image: expediagroup/insights-explorer
dockerfile: ./Dockerfile
- name: Convertbot
image: expediagroup/insights-explorer-convertbot
dockerfile: ./packages/convertbot/Dockerfile
- name: Slackbot
image: expediagroup/insights-explorer-slackbot
dockerfile: ./packages/slackbot/Dockerfile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Parse release version
run: |
VERSION=${GITHUB_REF_NAME#v*}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_ENV
echo "MINOR=$(echo $VERSION | cut -d. -f2)" >> $GITHUB_ENV
echo "PATCH=$(echo $VERSION | cut -d. -f3)" >> $GITHUB_ENV
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta - ${{ matrix.name }}
uses: docker/metadata-action@v5
id: meta
with:
images: |
${{ env.REGISTRY }}/${{ matrix.image }}
flavor: |
latest=true
tags: |
type=raw,value=${{ env.VERSION }}
type=raw,value=${{ env.MAJOR }}.${{ env.MINOR }}
type=raw,value=${{ env.MAJOR }},enable=${{ ! env.MAJOR == 0 }}
- name: Docker build - ${{ matrix.name }}
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max