-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yaml
More file actions
104 lines (96 loc) · 3.59 KB
/
action.yaml
File metadata and controls
104 lines (96 loc) · 3.59 KB
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
#
# Copyright 2026 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: Setup Dapr Runtime
description: >
Initialises the Dapr runtime via "dapr init". Requires the Dapr CLI to be
installed first (use the setup-dapr-cli action). Defaults to the highest
semver release (stable releases sort above pre-releases of the same version).
If a commit is provided, the daprd binary is replaced with one built from
that ref after init completes.
inputs:
version:
description: >
Dapr runtime version passed to "dapr init" (e.g. "1.14.0"). Omit to use
the latest stable release (highest semver, not necessarily the most
recently published). Always used, even when commit is set.
required: false
default: ''
commit:
description: >
A git commit SHA or ref in the dapr/dapr repository. When provided,
"dapr init" runs first (using the version input to set up the runtime
environment), then the daprd binary is replaced with one built from
source at this ref. Go will be installed automatically if not already
available.
required: false
default: ''
github-token:
description: >
GitHub token used to authenticate API requests when resolving the
latest release version. Avoids unauthenticated rate limits (60 req/hr).
required: true
outputs:
version:
description: The Dapr runtime version that was installed.
value: ${{ steps.version.outputs.version }}
runs:
using: composite
steps:
- name: Determine Dapr runtime version
id: version
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: |
VERSION="${{ inputs.version }}"
if [ -z "$VERSION" ]; then
VERSIONS=$(curl -fsS -H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/dapr/dapr/releases?per_page=100" \
| jq -r '.[].tag_name' \
| sed 's/^v//')
VERSION=$(echo "$VERSIONS" \
| sed '/-/! s/$/_/' \
| sort -rV \
| sed 's/_$//' \
| head -1)
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Init Dapr runtime
shell: bash
run: dapr uninstall --all && dapr init --runtime-version ${{ steps.version.outputs.version }}
- name: Check if Go is available
id: check-go
if: inputs.commit != ''
shell: bash
run: |
if command -v go &>/dev/null; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Go
if: inputs.commit != '' && steps.check-go.outputs.available == 'false'
uses: actions/setup-go@v5
with:
go-version: stable
- name: Build daprd from commit
if: inputs.commit != ''
shell: bash
run: |
TMPDIR=$(mktemp -d)
git clone --filter=blob:none https://github.com/dapr/dapr.git "$TMPDIR/dapr"
cd "$TMPDIR/dapr"
git checkout "${{ inputs.commit }}"
GOOS=linux GOARCH=amd64 make
mkdir -p "$HOME/.dapr/bin/"
cp dist/linux_amd64/release/daprd "$HOME/.dapr/bin/daprd"