Skip to content

Commit b5e3a1c

Browse files
authored
feat: Change CLI download links (#22)
* ci: Add dev and prod hosting envs * feat: Change download links to separated repos * ci: Change paths for separated CLIs
1 parent fd020b0 commit b5e3a1c

11 files changed

+136
-27
lines changed

.firebaserc

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"projects": {
33
"default": "golioth"
4+
},
5+
"targets": {
6+
"golioth": {
7+
"hosting": {
8+
"docs-dev": [
9+
"golioth-docs-dev"
10+
],
11+
"docs-prod": [
12+
"golioth-docs"
13+
]
14+
}
15+
}
416
}
5-
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file was auto-generated by the Firebase CLI
2+
# https://github.com/firebase/firebase-tools
3+
4+
name: Deploy to Firebase Hosting on merge
5+
'on':
6+
push:
7+
branches:
8+
- develop
9+
jobs:
10+
build_and_deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- run: npm install && npm run build
15+
- uses: FirebaseExtended/action-hosting-deploy@v0
16+
with:
17+
repoToken: '${{ secrets.GITHUB_TOKEN }}'
18+
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GOLIOTH }}'
19+
channelId: live
20+
projectId: golioth
21+
target: docs-prod
22+
env:
23+
FIREBASE_CLI_PREVIEWS: hostingchannels

.github/workflows/firebase-hosting-merge.yml .github/workflows/firebase-hosting-merge-main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ jobs:
1818
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GOLIOTH }}'
1919
channelId: live
2020
projectId: golioth
21+
target: docs-prod
2122
env:
2223
FIREBASE_CLI_PREVIEWS: hostingchannels

.github/workflows/firebase-hosting-pull-request.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ jobs:
1414
repoToken: '${{ secrets.GITHUB_TOKEN }}'
1515
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GOLIOTH }}'
1616
projectId: golioth
17+
target: docs-dev
1718
env:
1819
FIREBASE_CLI_PREVIEWS: hostingchannels

docs/guides/getting-started/2-installing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: installing
33
title: Installing Tools
44
---
55

6-
import InstallTools from '../../partials/install-tools.md'
6+
import InstallTools from '../../partials/install-tools.mdx'
77

88
<InstallTools/>
99

docs/guides/quickstart/2-installing.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Installing Goliothctl
55

66
`goliothctl` is a command-line utility that lets you work with Golioth, from creating your account to registering devices to interacting with _device services_ (more on those later.) It runs on your local machine so you'll want to install the version that's appropriate for your operating system:
77

8-
import InstallTools from '../../partials/install-tools.md'
8+
import InstallTools from '../../partials/install-tools.mdx'
99

1010
<InstallTools/>
1111

@@ -30,12 +30,14 @@ brew tap golioth/tap
3030
```
3131

3232
The available CLIs are:
33-
* `goliothctl`
33+
34+
- `goliothctl`
35+
- `coap`
3436

3537
Install them with `brew install`
3638

3739
```
38-
brew install goliothctl
40+
brew install goliothctl coap
3941
```
4042

4143
Alternatively you can also install the CLI directly (without adding a tap globally)
@@ -45,10 +47,12 @@ brew install golioth/tap/goliothctl
4547
```
4648

4749
Verify that `goliothctl` is installed correctly by checking the version
50+
4851
```
4952
$ goliothctl version
50-
0.10.3
53+
1.0.0
5154
```
55+
5256
#### Linux (Binaries)
5357

54-
Running the binary from linux may require it to be added to the PATH variable or to be run as a script: `./goliothctl`
58+
Running the binary from linux may require it to be added to the PATH variable or to be run as a script: `./goliothctl`

docs/partials/install-tools.md

-15
This file was deleted.

docs/partials/install-tools.mdx

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
### Download Pre-built CLIs
2+
3+
You can download the latest tools here. Binaries are available for Linux, macOS and Windows.
4+
5+
export const formatCliName = (name) => {
6+
return name.split("-").join(" ");
7+
};
8+
9+
export const DownloadLink = ({ variant, cliName, osName }) => {
10+
return (
11+
<a
12+
href={`https://storage.googleapis.com/golioth-cli-releases/${cliName}/latest/${cliName}_latest_${variant}.tar.gz`}
13+
>
14+
Download {formatCliName(cliName)} for {osName}
15+
</a>
16+
);
17+
};
18+
19+
export const DownloadLinks = ({ variant, osName, clis }) => {
20+
return clis.map((cliName) => {
21+
return (
22+
<>
23+
<DownloadLink
24+
key={`${variant}-${osName}-${cliName}`}
25+
variant={variant}
26+
cliName={cliName}
27+
osName={osName}
28+
/>
29+
<br />
30+
</>
31+
);
32+
});
33+
};
34+
35+
export const ChecksumsLinks = ({ clis }) => {
36+
return clis.map((cliName) => {
37+
return (
38+
<>
39+
<a
40+
key={`${cliName}-checksum`}
41+
href={`https://storage.googleapis.com/golioth-cli-releases/${cliName}/latest/checksums.txt`}
42+
>
43+
checksums.txt for {cliName}
44+
</a>
45+
<br />
46+
</>
47+
);
48+
});
49+
};
50+
51+
| Operating System | Download link |
52+
| ---------------- | ------------------------------------------------------------------------------------------------- |
53+
| macOS | <DownloadLinks variant="macos_64bit" osName="macOS" clis={["goliothctl","coap-cli"]} /> |
54+
| Linux 32bit | <DownloadLinks variant="linux_32bit" osName="Linux 32bit" clis={["goliothctl","coap-cli"]} /> |
55+
| Linux 64bit | <DownloadLinks variant="linux_64bit" osName="Linux 64bit" clis={["goliothctl","coap-cli"]} /> |
56+
| ARM Linux 64bit | <DownloadLinks variant="linux_arm64" osName="ARM Linux 64bit" clis={["goliothctl","coap-cli"]} /> |
57+
| Windows 32bit | <DownloadLinks variant="windows_32bit" osName="Windows 32bit" clis={["goliothctl","coap-cli"]} /> |
58+
| Windows 64bit | <DownloadLinks variant="windows_64bit" osName="Windows 64bit" clis={["goliothctl","coap-cli"]} /> |
59+
| Checksums | <ChecksumsLinks clis={["goliothctl","coap-cli"]} /> |
60+
61+
Each zip file contains [goliothctl](/docs/reference/goliothctl/goliothctl) and [coap](/docs/reference/coap/coap) command line tools.

firebase.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
{
22
"hosting": [
33
{
4-
"site": "golioth-docs",
4+
"target": "docs-dev",
5+
"public": "build",
6+
"ignore": [
7+
"firebase.json",
8+
"**/.*",
9+
"**/node_modules/**"
10+
],
11+
"rewrites": [
12+
{
13+
"source": "**",
14+
"destination": "/index.html"
15+
}
16+
]
17+
},
18+
{
19+
"target": "docs-prod",
520
"public": "build",
621
"ignore": [
722
"firebase.json",

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "docusaurus build",
99
"swizzle": "docusaurus swizzle",
1010
"deploy": "docusaurus deploy",
11-
"fb-deploy": "npm run build && firebase deploy --only hosting:golioth-docs",
11+
"fb-deploy-prod": "npm run build && firebase deploy --only hosting:docs-prod",
12+
"fb-deploy-dev": "npm run build && firebase deploy --only hosting:docs-dev",
1213
"serve": "docusaurus serve",
1314
"update-external-docs": "./scripts/update_external_docs.sh",
1415
"clear": "docusaurus clear"
@@ -35,4 +36,4 @@
3536
"last 1 safari version"
3637
]
3738
}
38-
}
39+
}

scripts/update_external_docs.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
CUR_DIR=$(pwd)
44

5-
# Generate Golioth Backend/CLI Docs
6-
pushd ../golioth
5+
# Generate goliothctl CLI docs
6+
pushd ../goliothctl
7+
git pull
8+
make docsgen ARGS="-o $CUR_DIR/docs/reference --baseUrl /docs/reference/"
9+
popd
10+
11+
# Generate coap cli docs
12+
pushd ../coap-cli
713
git pull
814
make docsgen ARGS="-o $CUR_DIR/docs/reference --baseUrl /docs/reference/"
915
popd

0 commit comments

Comments
 (0)