Skip to content

Commit 4e4bb94

Browse files
committed
initial port from ts-actions
1 parent abb1401 commit 4e4bb94

File tree

5 files changed

+96
-1
lines changed

5 files changed

+96
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "test install cli action"
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test-install-cli:
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, windows-latest]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: ./
15+
id: install-kittycad
16+
- name: check-install
17+
run: |
18+
echo "Version from output is: ${{ steps.install-kittycad.outputs.version }}"
19+
kittycad --version

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# install-cli
1+
### Install KittyCAD CLI
2+
3+
If you want to use the KittyCAD cli directly in your actions, for example:
4+
```yml
5+
name: "install KittyCAD cli"
6+
on:
7+
pull_request:
8+
jobs:
9+
my-job:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: KittyCAD/ts-actions/install-kittycad@v0.2.2
14+
- name: use KittyCAD cli
15+
run: kittycad --version # do things with cli
16+
env:
17+
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
18+
```

action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'install-kittycad-cli-action'
2+
description: 'Install KittyCAD CLI on a Linux or Windows host'
3+
4+
outputs:
5+
version:
6+
description: 'The KittyCAD CLI version that was installed'
7+
value: ${{ steps.set-output.outputs.version }}
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
13+
- name: install cli Linux
14+
id: install-kittycad-cli
15+
if: runner.os == 'Linux'
16+
run: sudo --preserve-env ${{ github.action_path }}/entrypoint.sh
17+
shell: bash
18+
19+
- name: install cli Windows
20+
if: runner.os == 'Windows'
21+
id: install-kittycad-cli-win
22+
run: sh ./entrypoint-win.sh
23+
shell: bash
24+
25+
- id: set-output
26+
run: echo "::set-output name=version::$(kittycad --version)"
27+
shell: bash

entrypoint-win.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Export the sha256sum for verification.
2+
export KITTYCAD_CLI_SHA256="ee4a911b6814262b4e4d83c877654715a6442d401dbd2a104ebf31e82101e024"
3+
4+
mkdir "C:\Program Files\KittyCAD"
5+
6+
# Download and check the sha256sum.
7+
curl -fSL "https://dl.kittycad.io/releases/cli/v0.0.9/cli-windows-amd64" -o "C:\Program Files\KittyCAD\kittycad.exe" \
8+
&& echo "${KITTYCAD_CLI_SHA256} C:\Program Files\KittyCAD\kittycad.exe" | sha256sum -c - \
9+
&& chmod a+x "C:\Program Files\KittyCAD\kittycad.exe"
10+
11+
echo "kittycad cli installed!"
12+
13+
# Add path for this shell to test cli
14+
export PATH=$PATH:"/C/Program Files/KittyCAD"
15+
# Run it!
16+
kittycad -h
17+
18+
# Add to Github path for later shells
19+
echo "C:\Program Files\KittyCAD" >> $GITHUB_PATH

entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Export the sha256sum for verification.
2+
export KITTYCAD_CLI_SHA256="ecb8310fdb91ea44e545a19d88ebbc3c391835bc00978679030746bcb85c5031"
3+
4+
5+
# Download and check the sha256sum.
6+
curl -fSL "https://dl.kittycad.io/releases/cli/v0.0.9/cli-linux-amd64" -o "/usr/local/bin/kittycad" \
7+
&& echo "${KITTYCAD_CLI_SHA256} /usr/local/bin/kittycad" | sha256sum -c - \
8+
&& chmod a+x "/usr/local/bin/kittycad"
9+
10+
echo "kittycad cli installed!"
11+
12+
# Run it!
13+
kittycad -h

0 commit comments

Comments
 (0)