Skip to content

Commit

Permalink
Refactor CI (#30)
Browse files Browse the repository at this point in the history
* Checkout repo first so dependencies can be cached

* Add documentation deployment

* Update link in readme

* Fix links in docs
  • Loading branch information
ire4ever1190 authored Dec 16, 2023
1 parent 056b5be commit 09fa5b1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@ jobs:

name: Nim ${{ matrix.nim }}
steps:
- name: Setup Nim Enviroment
uses: actions/checkout@master

- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-${{ matrix.nim }}-${{ hashFiles('dimscmd.nimble') }}

- name: Setup Nim Enviroment
uses: actions/checkout@master
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: ${{ matrix.nim }}

- name: Update nimble
run: nimble update

Expand All @@ -41,3 +43,30 @@ jobs:

- name: Check doc examples
run: nimble doc --deepcopy:on --threads:off --project src/dimscmd.nim

docs:
needs: test
if: github.ref == 'refs/heads/master'
permissions:
pages: write # To deploy to Pages
id-token: write # Verify deployment
runs-on: ubuntu-latest
name: "Deploy documentation"
steps:
- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-stable-${{ hashFiles('dimscmd.nimble') }}

- uses: jiro4989/setup-nim-action@v1
with:
nim-version: stable

- name: "Build documentation"
uses: ire4ever1190/nim-docs-action@v1
with:
main-file: "src/dimscmd.nim"
deploy: "pages"

2 changes: 1 addition & 1 deletion readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Dimscord Command Handler

This is built on top of the amazing `dimscord library <https://github.com/krisppurg/dimscord>`_ so if you have any questions about using dimscord or dimscmd then join the `dimscord discord <https://discord.com/invite/dimscord>`_ (please send questions about dimscmd in the #dimscmd channel)

`Docs available here <https://tempdocs.netlify.app/dimscmd/stable>`_
`Docs available here <https://ire4ever1190.github.io/dimscmd/dimscmd>`_

Install
====
Expand Down
4 changes: 2 additions & 2 deletions src/dimscmd.nim
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ macro addSlash*(router: CommandHandler, name: string, parameters: varargs[untype
result &= param

proc addAlias*(group: CommandGroup, commandName: string, aliases: openArray[string]) =
## Like addChatAlias_ or addSlashAlias_ except more generic
## Like [addChatAlias] or [addSlashAlias] except more generic
runnableExamples "-r:off -d:ssl":
import dimscord
let cmd = newDiscordClient("TOKEN").newHandler()
Expand Down Expand Up @@ -340,7 +340,7 @@ proc addChatAlias*(router: CommandHandler, commandName: string, aliases: openArr
router.chatCommands.addAlias(commandName, aliases)

proc addSlashAlias*(router: CommandHandler, commandName: string, aliases: openArray[string]) =
## Works like addChatAlias_ except it makes the alias for a slash command instead
## Works like [addChatAlias] except it makes the alias for a slash command instead
router.slashCommands.addAlias(commandName, aliases)

proc registerCommands*(handler: CommandHandler) {.async.} =
Expand Down

0 comments on commit 09fa5b1

Please sign in to comment.