Skip to content

Commit

Permalink
feat: add docusaurus site
Browse files Browse the repository at this point in the history
Generated initiail docs with 1.0.2 versioning.
  • Loading branch information
retr0h committed Dec 29, 2023
1 parent 2feda0a commit 3dad42d
Show file tree
Hide file tree
Showing 33 changed files with 33,964 additions and 148 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Test Deploy to GitHub Pages

on:
pull_request:
branches:
- main

jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
cache-dependency-path: ./docs/yarn.lock
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test build website
run: task docs:build
47 changes: 47 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Deploy to GitHub Pages

on:
push:
branches:
- main

permissions:
contents: write

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
cache-dependency-path: ./docs/yarn.lock
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build website
run: task docs:build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ cover.out
dist/
result.xml
test/integration/tmp/
.task/
154 changes: 6 additions & 148 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Gilt

<img src="asset/gilt.png" align="left" width=20% height=20%>
<img src="img/gilt.png" align="left" width="250px" height="250px" />

Gilt is a tool which aims to make repo management, manageable. Gilt
clones repositories at a particular version, then overlays the repository to
Expand All @@ -17,153 +17,13 @@ often shared, but Ansible's [Galaxy][] has no mechanism to handle this.

<br clear="left"/>

## Port
## Documentation

This project is a golang port of [Gilt][], and aims to correct poor decisions
made in the python version, primarially around config syntax, and not supporting
braches in favor of reproducibility.
[Installation][] | [Usage][] | [Documentation][]

## Installation

### Homebrew Tap

$ brew install retr0h/tap/go-gilt

### Go Install

$ go install github.com/retr0h/go-gilt@latest

## Configuration

Gilt uses [Viper][] to load configuation through multpile methods.

### Config File

Create the giltfile (`Giltfile.yaml`).

Clone the specified `url`@`version` to the configurable path `--gilt-dir`.
Extract the repo the `dstDir` when `dstDir` is provided. Otherwise, copy files
and/or directories to the desired destinations.

```yaml
---
giltDir: ~/.gilt/clone
debug: false
repositories:
- git: https://github.com/retr0h/ansible-etcd.git
sha: 77a95b7
dstDir: roles/retr0h.ansible-etcd
- git: https://github.com/retr0h/ansible-etcd.git
tag: 1.1
dstDir: roles/retr0h.ansible-etcd-tag
- git: https://github.com/lorin/openstack-ansible-modules.git
sha: 2677cc3
sources:
- src: "*_manage"
dstDir: library
- src: nova_quota
dstDir: library
- src: neutron_router
dstFile: library/neutron_router.py
- src: tests
dstDir: tests
commands:
- cmd: ansible-playbook
args:
- -i,
- playbook.yml
- cmd: bash
args:
- -c
- who | grep tty
```

### Env Vars

The config file can be overriden/defined through env vars.

$ GILT_GILTFILE=Giltfile.yaml \
GILT_GILTDIR=~/.gilt/clone \
GILT_DEBUG=false \
go-gilt overlay

### Command Flags

The config file and/or env vars can be overriden/defined through cli flags.

$ go-gilt \
--gilt-file=Giltfile.yaml \
--gilt-dir=~/.gilt/clone \
--debug \
overlay

## Usage

### CLI

#### Overlay Repository

Overlay a remote repository into the destination provided.

$ gilt overlay

#### Debug

Display the git commands being executed.

$ gilt --debug overlay

### Package

#### Overlay Repository

See example client in `examples/go-client/`.

```golang
func main() {
debug := true
logger := getLogger(debug)

c := config.Repositories{
Debug: debug,
GiltDir: "~/.gilt",
Repositories: []config.Repository{
{
Git: "https://github.com/retr0h/ansible-etcd.git",
SHA: "77a95b7",
DstDir: "../tmp/retr0h.ansible-etcd",
},
},
}

var r repositoriesManager = repositories.New(c, logger)
r.Overlay()
}
```

## Building

$ task build

## Testing

### Dependencies

Check installed dependencies:

$ task deps:check

To execute tests:

$ task test

Auto format code:

$ task fmt

List helpful targets:

$ task
[Installation]: https://retr0h.github.io/go-gilt/installation
[Usage]: https://retr0h.github.io/go-gilt/usage
[Documentation]: https://retr0h.github.io/go-gilt/

## License

Expand All @@ -174,8 +34,6 @@ and designed by [@nanotron][].
If you have some other use in mind, contact us.

[Galaxy]: https://docs.ansible.com/ansible/latest/reference_appendices/galaxy.html
[Gilt]: http:https://gilt.readthedocs.io/en/latest/
[Viper]: https://github.com/spf13/viper
[MIT]: LICENSE
[Creative Commons NoDerivatives 4.0 License]: https://creativecommons.org/licenses/by-nd/4.0/
[@nanotron]: https://github.com/nanotron
5 changes: 5 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ vars:
sh: git rev-parse --show-toplevel
MAIN_PACKAGE: main.go

includes:
docs:
taskfile: ./docs
dir: ./docs

tasks:
deps:
desc: Install dependencies
Expand Down
Binary file added asset/favicon.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
58 changes: 58 additions & 0 deletions docs/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: "3"

tasks:
yarn:install:
desc: Setup Docusaurus locally
cmds:
- yarn install
sources:
- package.json
- yarn.lock

build:
desc: Build website
deps:
- yarn:install
cmds:
- npx docusaurus build

start:
desc: Start website
deps:
- yarn:install
vars:
HOST: '{{default "localhost" .HOST}}'
PORT: '{{default "3001" .PORT}}'
cmds:
- npx docusaurus start --no-open --host={{.HOST}} --port={{.PORT}}

serve:
desc: Preview website
deps:
- yarn:install
vars:
HOST: '{{default "localhost" .HOST}}'
PORT: '{{default "3001" .PORT}}'
cmds:
- npx docusaurus serve --no-open --host={{.HOST}} --port={{.PORT}}

clean:
desc: Clean temp directories
cmds:
- rm -rf ./build

bump:
desc: Create a new documentation version
vars:
VERSION: '{{.VERSION}}'
cmds:
- npx docusaurus docs:version {{.VERSION}}
requires:
vars:
- VERSION

deploy:
desc: Build and deploy Docusaurus
summary: Requires GIT_USER and GIT_PASS envs to be previous set
cmds:
- npx docusaurus deploy
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
Loading

0 comments on commit 3dad42d

Please sign in to comment.