forked from dapr/quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (175 loc) · 6.64 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#
# Copyright 2021 The Dapr Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: samples
on:
push:
branches:
- master
- feature/new_quickstarts
- release-*
tags:
- v*
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries
runs-on: ${{ matrix.os }}
env:
TARGET_OS: ${{ matrix.target_os }}
TARGET_ARCH: ${{ matrix.target_arch }}
DOCKER_CLI_EXPERIMENTAL: enabled
strategy:
matrix:
os: [ubuntu-latest]
target_arch: [arm, arm64, amd64]
include:
- os: ubuntu-latest
target_os: linux
exclude:
- os: windows-latest
target_arch: arm
- os: macOS-latest
target_arch: arm
- os: windows-latest
target_arch: arm64
- os: macOS-latest
target_arch: arm64
steps:
- name: Check Docker version
run: docker --version
- name: Check out code
uses: actions/checkout@v2
- name: Parse release version and set REL_VERSION
run: python ./.github/scripts/get_release_version.py
- name: Set Docker's multiarch/qemu-user-static
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name mybuilder --driver docker-container --use
- name: Check platforms buildx supports
run: docker buildx inspect --bootstrap
- name: Build docker image
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Building image for ${sample}..."
pushd ${sample}
make build
popd
done
- name: docker login
run: |
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: publish image to dockerhub
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Push image for ${sample}..."
pushd ${sample}
make push
popd
done
- name: GitHub container registry login
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
env:
SAMPLE_REGISTRY: ghcr.io/dapr/samples
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Building image for ${sample}..."
pushd ${sample}
make build
popd
done
- name: publish image to ghcr
if: github.event_name != 'pull_request'
env:
SAMPLE_REGISTRY: ghcr.io/dapr/samples
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Push image for ${sample}..."
pushd ${sample}
make push
popd
done
publish:
name: Publish docker manifest
needs: build
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Parse release version and set REL_VERSION
run: python ./.github/scripts/get_release_version.py
- name: create docker manifest
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Building image for ${sample}..."
pushd ${sample}
make manifest-create
popd
done
- name: docker login
run: |
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: publish manifest to dockerhub
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Push image for ${sample}..."
pushd ${sample}
make manifest-push
popd
done
- name: GitHub container registry login
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: create ghcr manifest
if: github.event_name != 'pull_request'
env:
SAMPLE_REGISTRY: ghcr.io/dapr/samples
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Building image for ${sample}..."
pushd ${sample}
make manifest-create
popd
done
- name: publish manifest to ghcr
if: github.event_name != 'pull_request'
env:
SAMPLE_REGISTRY: ghcr.io/dapr/samples
run: |
SAMPLE_LIST=(tutorials/hello-kubernetes tutorials/distributed-calculator tutorials/pub-sub tutorials/bindings tutorials/observability tutorials/secretstore)
for sample in "${SAMPLE_LIST[@]}"; do
echo "Push image for ${sample}..."
pushd ${sample}
make manifest-push
popd
done