-
Notifications
You must be signed in to change notification settings - Fork 22
89 lines (79 loc) · 2.71 KB
/
ci.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
85
86
87
88
89
name: GitHub CI
on:
pull_request:
push:
schedule:
- cron: 0 0 * * 0
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
generate-jobs:
name: Generate Jobs
runs-on: ubuntu-latest
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
steps:
- uses: actions/checkout@v3
- uses: docker-library/bashbrew@HEAD
- id: generate-jobs
name: Generate Jobs
run: |
strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")"
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
jq . <<<"$strategy" # sanity check / debugging aid
test:
needs: generate-jobs
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: ${{ matrix.name }} - test
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Prepare Environment
run: ${{ matrix.runs.prepare }}
- name: Pull Dependencies
run: ${{ matrix.runs.pull }}
- name: Build ${{ matrix.name }}
run: ${{ matrix.runs.build }}
- name: History ${{ matrix.name }}
run: ${{ matrix.runs.history }}
- name: Test ${{ matrix.name }}
run: ${{ matrix.runs.test }}
- name: '"docker images"'
run: ${{ matrix.runs.images }}
build_and_push:
if: github.event_name == 'push'
needs:
- generate-jobs
- test
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: ${{ matrix.name }} - Build and push
runs-on: ${{ matrix.os }}
steps:
# Tags are created by generate.sh in the format `valkey-container:<tag>`
# This step modifies the tags to `username/valkey:<tag>` to be provided to build-push github action.
- name: Modify Tags
id: modify_tags
run: |
original_tags="${{ toJson(matrix.meta.entries[0].tags) }}"
tags=$(echo $original_tags | sed 's/valkey-container/${{ secrets.DOCKERHUB_USERNAME }}\/valkey/g'| sed 's/\[ *//; s/ *\]//; s/ //g')
echo "modified_tags=$tags" >> $GITHUB_OUTPUT
- 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:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
file: ./${{ matrix.meta.entries[0].directory }}/Dockerfile
push: true
tags: ${{ steps.modify_tags.outputs.modified_tags }}
platforms: linux/amd64,linux/arm64
provenance: false
load: false