forked from meaningful-ooo/docker-fish
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (76 loc) · 2.65 KB
/
build-images.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
name: Build and push Docker images
on:
push:
paths:
- ".github/workflows/**"
branches:
- "main"
pull_request:
types:
- opened
- synchronize
jobs:
build-image:
name: Build and push fish image
runs-on: ubuntu-latest
strategy:
matrix:
version: [
{ fish: 3.0.2, alpine: 3.11 },
{ fish: 3.1.2, alpine: 3.13 },
{ fish: 3.2.2, alpine: 3.14 },
{ fish: 3.3.1, alpine: 3.15 },
{ fish: 3.4.1, alpine: 3.16 },
{ fish: 3.5.1, alpine: 3.17 },
{ fish: 3.6.1, alpine: 3.18 },
{ fish: 3.6.3, alpine: 3.19 },
{ fish: 3.7.0, alpine: "edge" },
# { fish: 3.6.1, alpine: "edge" }, # priorize latest alpine version
]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: debug
run: |
echo "index: ${{ strategy.job-index }}, total: ${{ strategy.job-total }}, equality?: $([ $(expr ${{ strategy.job-index }} + 1) = ${{ strategy.job-total }} ]"
- name: Docker meta
id: meta
uses: docker/[email protected]
with:
# list of Docker images to use as base name for tags
images: |
purefish/docker-fish
# ghcr.io/pure-fish/docker-fish # need token
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}},value=${{matrix.version.fish}}
type=raw,value=latest,enable=${{ strategy.job-index == strategy.job-total - 1 }}
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build fish:${{ matrix.version.fish }} image
uses: docker/build-push-action@v5
with:
push: true
context: .
file: ./Dockerfile
build-contexts: |
alpine=docker-image://alpine:${{ matrix.version.alpine }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Test installed version match expected ${{ matrix.version.fish }}
run: |
docker run \
--rm \
purefish/docker-fish:${{ matrix.version.fish }} \
'fish --version | grep ${{ matrix.version.fish }}'