forked from cybozu-go/moco
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.39 KB
/
build-mysqld-exporter-container.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
name: "Build mysqld exporter container"
on:
pull_request:
paths:
- "containers/mysqld_exporter/**"
- ".github/workflows/build-mysqld-exporter-container.yaml"
- "!**.md"
push:
branches:
- 'main'
paths:
- "containers/mysqld_exporter/**"
- ".github/workflows/build-mysqld-exporter-container.yaml"
- "!**.md"
jobs:
build:
runs-on: ${{ vars.IMAGE_BUILD_RUNNER || 'ubuntu-20.04' }}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check TAG file
working-directory: containers
run: |
result="$(./tag_exists moco/mysqld_exporter mysqld_exporter)"
if [ "$result" = ok ]; then
exit 1
fi
echo "TAG=$(cat ./mysqld_exporter/TAG)" >> $GITHUB_ENV
- uses: docker/build-push-action@v4
with:
context: containers/mysqld_exporter/.
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/main' }}
tags: ghcr.io/cybozu-go/moco/mysqld_exporter:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max