-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
97 lines (85 loc) · 3.46 KB
/
action.yml
File metadata and controls
97 lines (85 loc) · 3.46 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
# Copyright © 2025 Cisco Systems, Inc. and its affiliates.
# All rights reserved.
# 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: 'Agent Directory Push'
description: 'Push records to your Agent Directory using the dirctl CLI.'
inputs:
directory_endpoint:
description: 'The Agent Directory SaaS endpoint URL.'
required: true
default: 'https://agent-directory.outshift.com'
dirctl_client_id:
description: 'Client ID for Agent Directory API key authentication.'
required: true
dirctl_secret:
description: 'Secret for Agent Directory API key authentication.'
required: true
record_file:
description: 'Path to the JSON file containing the directory record to push (relative to repository root).'
required: true
organization_name:
description: 'The organization name where to push the record.'
required: true
record_name:
description: 'The name of the record to be pushed. Overrides the name in the record file.'
required: false
record_version:
description: 'The version of the record to be pushed. Overrides the version in the record file.'
required: false
cosign_private_key:
description: 'Cosign private key content for signing the record.'
required: false
cosign_private_key_password:
description: 'Password for the encrypted cosign private key used to sign the record.'
required: false
dirctl_version:
description: 'Version of dirctl to download and use.'
required: false
default: 'v0.5.1'
runs:
using: 'composite'
steps:
- name: Detect OS and Architecture
shell: bash
run: |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
*) echo "Error: Unsupported architecture $ARCH" && exit 1 ;;
esac
echo "DIRCTL_OS=$OS" >> $GITHUB_ENV
echo "DIRCTL_ARCH=$ARCH" >> $GITHUB_ENV
echo "Detected OS: $OS, Architecture: $ARCH"
- name: Download and install dirctl
shell: bash
run: |
DIRCTL_URL="https://github.com/agntcy/dir/releases/download/${{ inputs.dirctl_version }}/dirctl-${DIRCTL_OS}-${DIRCTL_ARCH}"
mkdir -p "$GITHUB_WORKSPACE/bin"
curl -L "$DIRCTL_URL" -o "$GITHUB_WORKSPACE/bin/dirctl"
chmod +x "$GITHUB_WORKSPACE/bin/dirctl"
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "Downloaded dirctl from: $DIRCTL_URL"
- name: Run Agent Directory Sign and Push
id: run_sign_push
shell: bash
run: |
bash ${{ github.action_path }}/entrypoint.sh \
-e "${{ inputs.directory_endpoint }}" \
-c "${{ inputs.dirctl_client_id }}" \
-s "${{ inputs.dirctl_secret }}" \
-f "${{ inputs.record_file }}" \
-o "${{ inputs.organization_name }}" \
-n "${{ inputs.record_name }}" \
-v "${{ inputs.record_version }}" \
-k "${{ inputs.cosign_private_key }}" \
-p "${{ inputs.cosign_private_key_password }}"