-
Notifications
You must be signed in to change notification settings - Fork 6
61 lines (61 loc) · 1.74 KB
/
build.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
name: Build
on:
push:
branches:
- master
tags:
- "*"
pull_request:
concurrency:
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.id }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
id:
- "alpine"
- "debian"
steps:
- name: Parse ID
run: |
set -x
distribution=${{ matrix.id }}
case "${{ github.ref }}" in
refs/tags/*)
version=$(echo "${{ github.ref }}" | sed -e "s,^refs/tags/,,g")
;;
*)
version=latest
;;
esac
tags="groonga/groonga:${version}-${{ matrix.id }}"
if [ ${{ matrix.id }} = "debian" -a "${version}" = "latest" ]; then
tags="${tags},groonga/groonga:latest"
fi
echo "DISTRIBUTION=${distribution}" >> ${GITHUB_ENV}
echo "CONTEXT=./${distribution}" >> ${GITHUB_ENV}
echo "TAGS=${tags}" >> ${GITHUB_ENV}
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/setup-buildx-action@v3
id: buildx
- uses: docker/build-push-action@v6
id: docker_build
with:
# cache-from: type=gha
# cache-to: type=gha,mode=max
context: ${{ env.CONTEXT }}
push: true
tags: ${{ env.TAGS }}
- name: Image info
run: |
echo "ref: ${{ github.ref }}"
echo "tags: ${{ env.TAGS }}"
echo "digest: ${{ steps.docker_build.outputs.digest }}"