Skip to content

Commit e82f87f

Browse files
committed
Update docs for centralised workflow
1 parent 7c07a72 commit e82f87f

File tree

5 files changed

+158
-18
lines changed

5 files changed

+158
-18
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- master
7+
paths-ignore:
8+
- docs/**
79

810
jobs:
911
build:

.github/workflows/docs.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- docs/**
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
env:
15+
DOCS_REPO: netsoc/docs
16+
DOCS_SUBDIR: cli
17+
18+
steps:
19+
- name: Checkout main repo
20+
uses: actions/checkout@v2
21+
with:
22+
path: main
23+
24+
- name: Checkout docs repo
25+
uses: actions/checkout@v2
26+
with:
27+
repository: ${{ env.DOCS_REPO }}
28+
persist-credentials: false
29+
fetch-depth: 0
30+
path: docs
31+
32+
- name: Update docs in docs repo
33+
run: |
34+
cp -a ../main/docs/ "./docs/$DOCS_SUBDIR/"
35+
36+
git config --local user.email "[email protected]"
37+
git config --local user.name "GitHub Action"
38+
39+
git add .
40+
git commit -m "Update ${{ github.repository }} documentation ($(echo ${{ github.sha }} | cut -c 1-8))"
41+
working-directory: docs
42+
43+
- name: Push updated docs
44+
uses: ad-m/github-push-action@master
45+
with:
46+
directory: docs
47+
repository: ${{ env.DOCS_REPO }}
48+
github_token: ${{ secrets.CI_PAT }}

.github/workflows/release.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,25 @@ jobs:
5656
bin/github.com/netsoc/cli-linux-amd64 docs -t markdown -o docs/reference/
5757
./gen_mkdocs_pages.py docs/reference/ > docs/reference/.pages
5858
59-
- name: Commit reference docs
59+
- id: stage_docs
60+
name: Stage reference docs changes
6061
run: |
6162
git config --local user.email "[email protected]"
6263
git config --local user.name "GitHub Action"
6364
6465
git add docs/reference/
65-
git commit -m "Re-generate documentation"
66+
git diff-index --quiet HEAD --
67+
68+
echo "::set-output name=changes::$?"
69+
70+
- name: Commit reference docs changes
71+
if: ${{ steps.stage_docs.outputs.changes == '1' }}
72+
run: git commit -m "Re-generate reference documentation"
6673

6774
- name: Push documentation
75+
if: ${{ steps.stage_docs.outputs.changes == '1' }}
6876
uses: ad-m/github-push-action@master
6977
with:
70-
github_token: '${{ secrets.GITHUB_TOKEN }}'
78+
# Use a PAT because we need to trigger a workflow run
79+
github_token: '${{ secrets.CI_PAT }}'
7180
tags: true

README.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@
22

33
_`netsoc` allows you to manage your Netsoc account and webspace from the command line!_
44

5-
## Install
5+
## Setting up
66

7-
1. Head to [the latest release](https://github.com/netsoc/cli/releases/latest) and grab the binary for your platform.
8-
9-
- For Linux, choose `cli-linux-amd64` (or `cli-linux-386` if you're on an old 32-bit system!)
10-
- For Mac, choose `cli-darwin-10.6-amd64`
11-
- For Windows, `cli-windows-4.0-amd64.exe` (`cli-windows-4.0-386.exe` on 32-bit)
12-
2. On Linux or Mac, do `chmod +x path/to/download/cli-<platform>`
13-
3. Run `path/to/download/cli-<platform>` to access the CLI!
14-
(On Windows you might need `.\Downloads\cli-windows-4.0-amd64.exe`)
15-
16-
If you're on Arch Linux, there's an [AUR package](https://aur.archlinux.org/packages/netsoc/).
17-
18-
## Docs
19-
20-
See [`docs/`](docs/) for the command manual.
7+
See [our documentation](https://docs.netsoc.ie/cli/) for more information.

docs/index.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,95 @@
11
# Netsoc CLI
2+
3+
Manage our services from the command line!
4+
5+
## Getting started
6+
7+
To get started with the CLI, you'll need to download the
8+
[latest release]({{ github_org }}/cli/releases/latest) from GitHub.
9+
10+
!!! note
11+
Unless your're on an old 32-bit system, always choose the `amd64` variant
12+
of the binary (even if you have an Intel CPU!). If you're on a Raspberry Pi,
13+
pick the `linux-arm-7` variant.
14+
15+
=== "Arch Linux"
16+
17+
1. Use your favourite AUR helper to install the `netsoc` package. For
18+
example with [`yay`](https://github.com/Jguer/yay):
19+
20+
```bash
21+
yay -S netsoc
22+
```
23+
24+
=== "Other Linux"
25+
26+
1. Download `cli-linux-<arch>` (almost certainly `amd64`)
27+
2. Make the binary executable:
28+
```bash
29+
chmod +x Downloads/cli-linux-amd64
30+
```
31+
32+
3. Move and rename the program into somewhere on your `$PATH` (so you can run it
33+
directly!), for example:
34+
```bash
35+
sudo mv Downloads/cli-linux-amd64 /usr/local/bin/netsoc
36+
```
37+
38+
=== "macOS"
39+
40+
1. Download `cli-darwin-10.6-amd64`
41+
2. Make the binary executable:
42+
```bash
43+
chmod +x Downloads/cli-darwin-10.6-amd64
44+
```
45+
46+
3. Move and rename the program into somewhere on your `$PATH` (so you can run it
47+
directly!), for example:
48+
```bash
49+
sudo mv Downloads/cli-darwin-10.16-amd64 /usr/local/bin/netsoc
50+
```
51+
52+
=== "Windows"
53+
54+
1. Download `cli-windows-4.0-<arch>.exe` (almost certainly `amd64`)
55+
2. Rename the file to `netsoc.exe` (exclude the `.exe` if you don't see it
56+
on the downloaded file)
57+
3. Move the file to somewhere you'll remember, e.g. `C:\tools\netsoc.exe`
58+
4. Open a PowerShell terminal and `cd` to where you copied the file, for
59+
example:
60+
61+
```powershell
62+
cd C:\tools
63+
```
64+
65+
You should now be able to run the CLI from your terminal as `netsoc` (on
66+
Windows make sure you're in the directory you copied the `.exe` to and use
67+
`.\netsoc.exe` instead).
68+
69+
## Using the CLI
70+
71+
Once installed, you need to log in to your account. To do this, run the
72+
following:
73+
74+
```bash
75+
# Replace `myusername` with your Netsoc username!
76+
netsoc account login myusername
77+
```
78+
79+
Now that you're logged in, you should be able to use the CLI! To make sure
80+
everything is working, run:
81+
82+
```bash
83+
$ netsoc account info
84+
╭────┬───────────┬───────────────────┬────────────┬───────────────────────╮
85+
│ ID │ USERNAME │ EMAIL │ NAME │ RENEWED │
86+
├────┼───────────┼───────────────────┼────────────┼───────────────────────┤
87+
│ 1 │ bro │ [email protected] │ Bro Dude │ 2020-09-27 20:47:14 │
88+
╰────┴───────────┴───────────────────┴────────────┴───────────────────────╯
89+
$
90+
```
91+
92+
See [the command reference](reference/netsoc/) for more details on commands
93+
provided by the CLI.
94+
95+
*[CLI]: Command Line Interface

0 commit comments

Comments
 (0)