-
Notifications
You must be signed in to change notification settings - Fork 55
127 lines (114 loc) · 4.71 KB
/
publish_latest.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Publish latest
on:
push:
branches: [master, main]
env:
IMAGE_NAME: "hstreamdb/hstream"
BUILDER_IMAGE_NAME: "hstreamdb/hstream-builder"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- hs_image: "hstreamdb/haskell:9.4"
ld_image: "hstreamdb/logdevice"
tag: "latest"
- hs_image: "hstreamdb/haskell:rqlite_9.4"
ld_image: "hstreamdb/logdevice:rqlite"
tag: "rqlite"
steps:
# Ref:
# - https://github.com/actions/runner-images/issues/2840
# - https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image
- name: Free disk space
run: |
echo "Before..."
df -h
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
"/usr/local/share/boost" \
/usr/lib/jvm || true
echo "After..."
df -h
- uses: actions/checkout@v3
with:
submodules: "recursive"
# We need tags. Also see: https://github.com/actions/checkout/issues/701
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get version info
run: |
echo "LATEST_TAG=$(git describe --tag --abbrev=0)" >> $GITHUB_ENV
echo "CURRENT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Docker build
run: |
docker build . -f docker/Dockerfile \
--build-arg HS_IMAGE=${{ matrix.hs_image }} \
--build-arg LD_IMAGE=${{ matrix.ld_image }} \
--build-arg HSTREAM_VERSION=${{ env.LATEST_TAG }} \
--build-arg HSTREAM_VERSION_COMMIT=${{ env.CURRENT_COMMIT }} \
-t ${IMAGE_NAME}:${{ matrix.tag }}
- name: Push image to dockerhub
run: docker push ${IMAGE_NAME}:${{ matrix.tag }}
- name: Build and push builder
run: |
docker build . -f docker/Dockerfile \
--build-arg HS_IMAGE=${{ matrix.hs_image }} \
--build-arg LD_IMAGE=${{ matrix.ld_image }} \
--build-arg HSTREAM_VERSION=${{ env.LATEST_TAG }} \
--build-arg HSTREAM_VERSION_COMMIT=${{ env.CURRENT_COMMIT }} \
--target builder \
-t ${BUILDER_IMAGE_NAME}:latest
# For cache
docker push ${BUILDER_IMAGE_NAME}:latest
trigger:
runs-on: ubuntu-latest
needs: build
steps:
# https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event
- name: Trigger testing ci
run: |
URL=https://api.github.com/repos/hstreamdb/integration-tests/dispatches
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
$URL \
--data "{\"event_type\": \"image_updated\", \"client_payload\": { \"tag\": \"latest\", \"commit_sha\": \"$GITHUB_SHA\" }}"
- name: Trigger jepsen test ci
run: |
URL=https://api.github.com/repos/hstreamdb/jepsen.hstream/dispatches
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
$URL \
--data "{\"event_type\": \"image_updated\", \"client_payload\": { \"tag\": \"latest\", \"commit_sha\": \"$GITHUB_SHA\" }}"
- name: Trigger bench ci
run: |
URL=https://api.github.com/repos/hstreamdb/bench/dispatches
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
$URL \
--data "{\"event_type\": \"image_updated\", \"client_payload\": { \"tag\": \"latest\", \"commit_sha\": \"$GITHUB_SHA\" }}"
- name: Trigger docs ci
run: |
URL=https://api.github.com/repos/hstreamdb/docs-next/dispatches
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
$URL \
--data "{\"event_type\": \"image_updated\", \"client_payload\": { \"tag\": \"latest\", \"commit_sha\": \"$GITHUB_SHA\" }}"