-
Notifications
You must be signed in to change notification settings - Fork 20
84 lines (76 loc) · 2.73 KB
/
containers.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build and upload Docker image
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
release-please:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
indexer-service-rs: ${{ steps.release-please.outputs.service--tag_name }}
indexer-tap-agent: ${{ steps.release-please.outputs.tap-agent--tag_name }}
steps:
- name: Release please
id: release-please
uses: googleapis/release-please-action@v4
builds-linux:
runs-on: ubuntu-latest
needs: release-please
strategy:
matrix:
target: [indexer-service-rs, indexer-tap-agent]
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Extract version from tag
id: extract_version
run: |
TAG_NAME="${{ needs.release-please.outputs[matrix.target] }}"
# Extract the version part from tags with prefix "${{ matrix.target }}-" using a regex pattern
if [[ "$TAG_NAME" =~ ^${{ matrix.target }}-(.*)$ ]]; then
VERSION="${BASH_REMATCH[1]}"
else
VERSION=""
fi
echo $VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.REGISTRY }}/${{matrix.target}}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern={{major}}.{{minor}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern={{major}},value=${{steps.extract_version.outputs.version}}
type=sha
- name: Log in to the Container registry
uses: docker/login-action@06895751d15a223ec091bea144ad5c7f50d228d0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
with:
context: ./
push: true
tags: ${{ steps.meta.outputs.tags }}
file: Dockerfile.${{ matrix.target }}