-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
148 lines (125 loc) · 4.31 KB
/
Copy pathaction.yml
File metadata and controls
148 lines (125 loc) · 4.31 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
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
name: 'Setup dpm'
description: 'Install the Digital Asset Package Manager (dpm) CLI for DAML development'
author: '0xsend'
branding:
icon: 'package'
color: 'blue'
inputs:
version:
description: 'Version of dpm to install (e.g., "3.4.9" or "latest")'
required: false
default: 'latest'
daml-version:
description: 'Version of DAML SDK to install (e.g., "3.4.9"). Leave empty to skip DAML SDK installation.'
required: false
default: ''
outputs:
version:
description: 'The version of dpm that was installed'
value: ${{ steps.install.outputs.version }}
path:
description: 'Path to the dpm installation directory'
value: ${{ steps.install.outputs.path }}
daml-version:
description: 'The version of DAML SDK that was installed (empty if not installed)'
value: ${{ steps.install-daml.outputs.version }}
runs:
using: 'composite'
steps:
- name: Determine version
id: version
shell: bash
run: |
if [[ "${{ inputs.version }}" == "latest" ]]; then
VERSION=$(curl -sS "https://get.digitalasset.com/install/latest")
else
VERSION="${{ inputs.version }}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Installing dpm version: ${VERSION}"
- name: Determine platform
id: platform
shell: bash
run: |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Map architecture names
case "${ARCH}" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
arm64) ARCH="arm64" ;;
*)
echo "Unsupported architecture: ${ARCH}"
exit 1
;;
esac
# Map OS names
case "${OS}" in
linux) OS="linux" ;;
darwin) OS="darwin" ;;
*)
echo "Unsupported OS: ${OS}"
exit 1
;;
esac
echo "os=${OS}" >> $GITHUB_OUTPUT
echo "arch=${ARCH}" >> $GITHUB_OUTPUT
echo "platform=${OS}-${ARCH}" >> $GITHUB_OUTPUT
echo "Detected platform: ${OS}-${ARCH}"
- name: Cache dpm
id: cache
uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/dpm/${{ steps.version.outputs.version }}
key: dpm-${{ steps.platform.outputs.platform }}-${{ steps.version.outputs.version }}
- name: Download and install dpm
id: install
shell: bash
env:
VERSION: ${{ steps.version.outputs.version }}
PLATFORM: ${{ steps.platform.outputs.platform }}
CACHE_HIT: ${{ steps.cache.outputs.cache-hit }}
run: |
INSTALL_DIR="${RUNNER_TOOL_CACHE}/dpm/${VERSION}"
if [[ "${CACHE_HIT}" == "true" ]]; then
echo "Using cached dpm installation"
else
echo "Downloading dpm ${VERSION} for ${PLATFORM}..."
TARBALL="dpm-${VERSION}-${PLATFORM}.tar.gz"
URL="https://artifactregistry.googleapis.com/download/v1/projects/da-images/locations/europe/repositories/public-generic/files/dpm-sdk:${VERSION}:${TARBALL}:download?alt=media"
mkdir -p "${INSTALL_DIR}"
curl -SLf "${URL}" -o "/tmp/${TARBALL}" --progress-bar
tar xzf "/tmp/${TARBALL}" -C "${INSTALL_DIR}" --strip-components=1
rm -f "/tmp/${TARBALL}"
chmod +x "${INSTALL_DIR}/bin/"*
echo "dpm installed to ${INSTALL_DIR}"
fi
# Add to PATH
echo "${INSTALL_DIR}/bin" >> $GITHUB_PATH
# Set outputs
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "path=${INSTALL_DIR}" >> $GITHUB_OUTPUT
- name: Verify installation
shell: bash
run: |
echo "Verifying dpm installation..."
dpm version
echo "dpm is ready to use"
# DAML SDK installation (optional) - uses dpm install
- name: Install DAML SDK
id: install-daml
if: inputs.daml-version != ''
shell: bash
env:
DAML_VERSION: ${{ inputs.daml-version }}
run: |
echo "Installing DAML SDK ${DAML_VERSION} via dpm..."
dpm install "${DAML_VERSION}"
echo "version=${DAML_VERSION}" >> $GITHUB_OUTPUT
- name: Verify DAML SDK installation
if: inputs.daml-version != ''
shell: bash
run: |
echo "Verifying DAML SDK installation..."
dpm version
echo "DAML SDK is ready to use"