Skip to content

Commit b752f85

Browse files
authored
Merge pull request #20 from microsoft/cli-refresh
Cli refresh
2 parents 3897633 + 306f8c1 commit b752f85

134 files changed

Lines changed: 3837 additions & 5137 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release-cli.yml‎

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: Release CLI
2+
3+
# Cross-build the `ada` CLI for the supported targets, bundle each binary
4+
# with the `radius/` artifact tree (recipes, resource types, env bicep,
5+
# bicepconfig), and attach the archives to a GitHub Release.
6+
#
7+
# Triggers:
8+
# * push of a tag matching `cli-v*` — publishes the release.
9+
# * manual `workflow_dispatch` with an explicit tag — useful for dry
10+
# runs against a feature branch.
11+
12+
on:
13+
push:
14+
tags:
15+
- 'cli-v*'
16+
workflow_dispatch:
17+
inputs:
18+
tag:
19+
description: 'Release tag to publish (e.g. cli-v0.1.0)'
20+
required: true
21+
type: string
22+
23+
permissions:
24+
contents: write
25+
26+
jobs:
27+
build:
28+
name: build ${{ matrix.target }}
29+
runs-on: ${{ matrix.runner }}
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- target: x86_64-unknown-linux-gnu
35+
runner: ubuntu-latest
36+
archive: tar.gz
37+
- target: aarch64-unknown-linux-gnu
38+
runner: ubuntu-latest
39+
archive: tar.gz
40+
# Cross-compile to arm64 from x64 linux. Avoids spinning up an
41+
# arm64 runner just for this binary.
42+
cross: true
43+
- target: x86_64-apple-darwin
44+
runner: macos-13
45+
archive: tar.gz
46+
- target: aarch64-apple-darwin
47+
runner: macos-14
48+
archive: tar.gz
49+
- target: x86_64-pc-windows-msvc
50+
runner: windows-latest
51+
archive: zip
52+
ext: .exe
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
57+
- name: Resolve tag
58+
id: tag
59+
shell: bash
60+
run: |
61+
set -euo pipefail
62+
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
63+
tag='${{ inputs.tag }}'
64+
else
65+
tag='${{ github.ref_name }}'
66+
fi
67+
if [[ ! "$tag" =~ ^cli-v ]]; then
68+
echo "::error::tag '$tag' must start with cli-v" >&2
69+
exit 1
70+
fi
71+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
72+
echo "version=${tag#cli-v}" >> "$GITHUB_OUTPUT"
73+
74+
- name: Install Rust toolchain
75+
uses: dtolnay/rust-toolchain@stable
76+
with:
77+
targets: ${{ matrix.target }}
78+
79+
- name: Install cross-compile linker (linux arm64)
80+
if: matrix.cross == true
81+
run: |
82+
sudo apt-get update
83+
sudo apt-get install -y gcc-aarch64-linux-gnu
84+
mkdir -p ~/.cargo
85+
cat >> ~/.cargo/config.toml <<'EOF'
86+
[target.aarch64-unknown-linux-gnu]
87+
linker = "aarch64-linux-gnu-gcc"
88+
EOF
89+
90+
- name: Build
91+
working-directory: cli
92+
run: cargo build --release --locked --target ${{ matrix.target }}
93+
94+
- name: Stage release tree
95+
id: stage
96+
shell: bash
97+
run: |
98+
set -euo pipefail
99+
version='${{ steps.tag.outputs.version }}'
100+
target='${{ matrix.target }}'
101+
stage="dist/ada-${version}-${target}"
102+
ext='${{ matrix.ext }}'
103+
mkdir -p "${stage}/bin" "${stage}/radius"
104+
cp "cli/target/${target}/release/ada${ext}" "${stage}/bin/ada${ext}"
105+
# Bundle the Radius asset tree as-is so install scripts can
106+
# drop it under $ADA_HOME/radius without any rewriting.
107+
cp -R radius/. "${stage}/radius/"
108+
cp cli/README.md "${stage}/README.md" || true
109+
cp LICENSE "${stage}/LICENSE" || true
110+
echo "stage=${stage}" >> "$GITHUB_OUTPUT"
111+
echo "name=ada-${version}-${target}" >> "$GITHUB_OUTPUT"
112+
113+
- name: Pack tar.gz
114+
if: matrix.archive == 'tar.gz'
115+
shell: bash
116+
run: |
117+
set -euo pipefail
118+
(cd dist && tar -czf "${{ steps.stage.outputs.name }}.tar.gz" "${{ steps.stage.outputs.name }}")
119+
(cd dist && shasum -a 256 "${{ steps.stage.outputs.name }}.tar.gz" > "${{ steps.stage.outputs.name }}.tar.gz.sha256")
120+
121+
- name: Pack zip
122+
if: matrix.archive == 'zip'
123+
shell: pwsh
124+
run: |
125+
$name = '${{ steps.stage.outputs.name }}'
126+
Push-Location dist
127+
Compress-Archive -Path $name -DestinationPath "$name.zip" -Force
128+
$hash = Get-FileHash -Algorithm SHA256 "$name.zip"
129+
"$($hash.Hash.ToLower()) $name.zip" | Out-File -Encoding ascii "$name.zip.sha256"
130+
Pop-Location
131+
132+
- name: Upload artifact
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: ${{ steps.stage.outputs.name }}
136+
path: |
137+
dist/${{ steps.stage.outputs.name }}.tar.gz
138+
dist/${{ steps.stage.outputs.name }}.tar.gz.sha256
139+
dist/${{ steps.stage.outputs.name }}.zip
140+
dist/${{ steps.stage.outputs.name }}.zip.sha256
141+
if-no-files-found: ignore
142+
143+
release:
144+
name: publish release
145+
needs: build
146+
runs-on: ubuntu-latest
147+
steps:
148+
- name: Checkout
149+
uses: actions/checkout@v4
150+
151+
- name: Resolve tag
152+
id: tag
153+
shell: bash
154+
run: |
155+
set -euo pipefail
156+
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
157+
tag='${{ inputs.tag }}'
158+
else
159+
tag='${{ github.ref_name }}'
160+
fi
161+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
162+
echo "version=${tag#cli-v}" >> "$GITHUB_OUTPUT"
163+
164+
- name: Download all artifacts
165+
uses: actions/download-artifact@v4
166+
with:
167+
path: dist
168+
merge-multiple: true
169+
170+
- name: List staged assets
171+
run: ls -lah dist
172+
173+
- name: Publish GitHub Release
174+
uses: ncipollo/release-action@v1
175+
with:
176+
allowUpdates: true
177+
artifactErrorsFailBuild: true
178+
tag: ${{ steps.tag.outputs.tag }}
179+
name: ada ${{ steps.tag.outputs.version }}
180+
artifacts: 'dist/*.tar.gz,dist/*.tar.gz.sha256,dist/*.zip,dist/*.zip.sha256'
181+
body: |
182+
Adaptive Apps CLI **${{ steps.tag.outputs.version }}**.
183+
184+
Each archive contains the `ada` binary plus the full Radius asset
185+
tree (`recipes/`, `resource-types/`, `*.bicep`, `bicepconfig.json`,
186+
`types.tgz`). Use the one-line installers to drop it under
187+
`~/.adaptive`:
188+
189+
```bash
190+
# macOS / Linux
191+
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/cli/install.sh | bash
192+
```
193+
194+
```powershell
195+
# Windows PowerShell
196+
iwr -useb https://raw.githubusercontent.com/${{ github.repository }}/main/cli/install.ps1 | iex
197+
```
198+
199+
Override the install root with `ADA_HOME=/custom/path` (or
200+
`-AdaHome` on Windows). Pin a version with
201+
`ADA_VERSION=${{ steps.tag.outputs.tag }}`.
Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Helm Charts
1+
name: Release Helm Chart
22

33
on:
44
workflow_dispatch:
@@ -7,46 +7,20 @@ on:
77
- main
88
paths:
99
- '.github/workflows/release-helm-charts.yml'
10-
- 'charts/portfolios/**'
10+
- 'charts/adaptive-apps/**'
1111

1212
env:
1313
OCI_REGISTRY: ghcr.io
14+
CHART_PATH: charts/adaptive-apps
15+
CHART_NAME: adaptive-apps
1416

1517
jobs:
1618
release:
17-
name: Release ${{ matrix.portfolio }}-${{ matrix.chart }}
19+
name: Release adaptive-apps chart
1820
runs-on: ubuntu-latest
1921
permissions:
2022
contents: write
2123
packages: write
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
include:
26-
- portfolio: min
27-
chart: min
28-
chart_path: charts/portfolios/min
29-
oci_repo: oci://ghcr.io/${{ github.repository_owner }}/adaptive-apps/charts/portfolios
30-
- portfolio: core
31-
chart: core
32-
chart_path: charts/portfolios/core
33-
oci_repo: oci://ghcr.io/${{ github.repository_owner }}/adaptive-apps/charts/portfolios
34-
- portfolio: ent
35-
chart: ent
36-
chart_path: charts/portfolios/ent
37-
oci_repo: oci://ghcr.io/${{ github.repository_owner }}/adaptive-apps/charts/portfolios
38-
- portfolio: min-ai
39-
chart: min-ai
40-
chart_path: charts/portfolios/min-ai
41-
oci_repo: oci://ghcr.io/${{ github.repository_owner }}/adaptive-apps/charts/portfolios
42-
- portfolio: core-ai
43-
chart: core-ai
44-
chart_path: charts/portfolios/core-ai
45-
oci_repo: oci://ghcr.io/${{ github.repository_owner }}/adaptive-apps/charts/portfolios
46-
- portfolio: ent-ai
47-
chart: ent-ai
48-
chart_path: charts/portfolios/ent-ai
49-
oci_repo: oci://ghcr.io/${{ github.repository_owner }}/adaptive-apps/charts/portfolios
5024

5125
steps:
5226
- name: Checkout code
@@ -57,37 +31,42 @@ jobs:
5731

5832
- name: Login to GitHub Container Registry
5933
run: |
60-
echo "${{ github.token }}" | helm registry login ${{ env.OCI_REGISTRY }} -u "${{ github.actor }}" --password-stdin
34+
echo "${{ github.token }}" | helm registry login ${{ env.OCI_REGISTRY }} \
35+
-u "${{ github.actor }}" --password-stdin
6136
6237
- name: Build chart dependencies
63-
run: helm dependency build ${{ matrix.chart_path }}
38+
run: helm dependency build ${{ env.CHART_PATH }}
6439

6540
- name: Lint chart
66-
run: helm lint ${{ matrix.chart_path }}
41+
run: helm lint ${{ env.CHART_PATH }}
6742

6843
- name: Package chart
6944
id: package
7045
run: |
7146
set -euo pipefail
7247
7348
mkdir -p .helm-packages
74-
helm package ${{ matrix.chart_path }} --destination .helm-packages
49+
helm package ${{ env.CHART_PATH }} --destination .helm-packages
7550
76-
chart_version="$(helm show chart ${{ matrix.chart_path }} | awk -F': ' '/^version:/ {print $2}')"
77-
package_file=".helm-packages/${{ matrix.chart }}-${chart_version}.tgz"
51+
chart_version="$(helm show chart ${{ env.CHART_PATH }} \
52+
| awk -F': ' '/^version:/ {print $2}')"
53+
package_file=".helm-packages/${{ env.CHART_NAME }}-${chart_version}.tgz"
7854
7955
if [[ ! -f "$package_file" ]]; then
8056
echo "Unable to find packaged chart at $package_file"
8157
exit 1
8258
fi
8359
84-
echo "version=$chart_version" >> "$GITHUB_OUTPUT"
85-
echo "package_file=$package_file" >> "$GITHUB_OUTPUT"
86-
echo "release_tag=helm-${{ matrix.portfolio }}-${{ matrix.chart }}-v${chart_version}" >> "$GITHUB_OUTPUT"
60+
echo "version=$chart_version" >> "$GITHUB_OUTPUT"
61+
echo "package_file=$package_file" >> "$GITHUB_OUTPUT"
62+
echo "release_tag=helm-${{ env.CHART_NAME }}-v${chart_version}" >> "$GITHUB_OUTPUT"
63+
echo "oci_repo=oci://${{ env.OCI_REGISTRY }}/${{ github.repository_owner }}/adaptive-apps/charts" \
64+
>> "$GITHUB_OUTPUT"
8765
8866
- name: Push chart to GHCR OCI registry
8967
run: |
90-
helm push "${{ steps.package.outputs.package_file }}" "${{ matrix.oci_repo }}"
68+
helm push "${{ steps.package.outputs.package_file }}" \
69+
"${{ steps.package.outputs.oci_repo }}"
9170
9271
- name: Create GitHub Release
9372
uses: ncipollo/release-action@v1
@@ -96,9 +75,21 @@ jobs:
9675
artifactErrorsFailBuild: true
9776
artifacts: ${{ steps.package.outputs.package_file }}
9877
tag: ${{ steps.package.outputs.release_tag }}
99-
name: Helm ${{ matrix.portfolio }}/${{ matrix.chart }} v${{ steps.package.outputs.version }}
78+
name: Helm ${{ env.CHART_NAME }} v${{ steps.package.outputs.version }}
10079
body: |
101-
Released Helm chart `${{ matrix.chart }}` for capability portfolio `${{ matrix.portfolio }}`.
80+
Released unified Helm chart `${{ env.CHART_NAME }}`.
10281
103-
OCI reference:
104-
`${{ matrix.oci_repo }}/${{ matrix.chart }}:${{ steps.package.outputs.version }}`
82+
Install:
83+
84+
```bash
85+
helm install <release> \
86+
${{ steps.package.outputs.oci_repo }}/${{ env.CHART_NAME }} \
87+
--version ${{ steps.package.outputs.version }} \
88+
-f profiles/<portfolio>.yaml
89+
```
90+
91+
Or with `ada`:
92+
93+
```bash
94+
ada bootstrap --portfolio <portfolio> --platform <platform>
95+
```

0 commit comments

Comments
 (0)