Skip to content

Commit 045410c

Browse files
authored
Merge pull request #114 from evan-buss/development
release: v4.5.0
2 parents 91bb21a + 2c5e202 commit 045410c

36 files changed

+636
-155
lines changed

.devcontainer/Dockerfile

-12
This file was deleted.

.devcontainer/devcontainer.json

+14-39
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,22 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/ubuntu
31
{
42
"name": "Ubuntu",
5-
"build": {
6-
"dockerfile": "Dockerfile",
7-
"args": {
8-
"VARIANT": "jammy"
9-
}
10-
},
11-
// Set *default* container specific settings.json values on container create.
12-
"settings": {
13-
"go.toolsManagement.checkForUpdates": "local",
14-
"go.addTags": {
15-
"tags": "json",
16-
"options": "json=omitempty",
17-
"promptForTags": false,
18-
"transform": "snakecase",
19-
"template": ""
20-
},
21-
"go.useLanguageServer": true,
22-
"go.gopath": "/go",
23-
"go.goroot": "/usr/local/go"
24-
},
25-
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
26-
// Add the IDs of extensions you want installed when the container is created.
27-
"extensions": [
28-
"golang.Go",
29-
"eamodio.gitlens",
30-
"bradlc.vscode-tailwindcss",
31-
"esbenp.prettier-vscode",
32-
"GitHub.copilot"
33-
],
3+
"image": "mcr.microsoft.com/devcontainers/base:0-jammy",
4+
345
// Use 'forwardPorts' to make a list of ports inside the container available locally.
356
// "forwardPorts": [],
7+
368
// Use 'postCreateCommand' to run commands after the container is created.
37-
// "postCreateCommand": "uname -a",
38-
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
39-
"remoteUser": "vscode",
9+
"postCreateCommand": "bash .devcontainer/setup.sh",
10+
11+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
12+
"remoteUser": "root",
4013
"features": {
41-
"docker-in-docker": "latest",
42-
"git": "latest",
43-
"sshd": "latest",
44-
"node": "lts",
45-
"golang": "latest"
14+
"ghcr.io/devcontainers/features/go:1": {},
15+
"ghcr.io/devcontainers/features/node:1": {}
16+
},
17+
"customizations": {
18+
"vscode": {
19+
"extensions": ["golang.go", "heybourn.headwind", "esbenp.prettier-vscode", "bradlc.vscode-tailwindcss", "ms-vscode.makefile-tools", "redhat.vscode-yaml"]
20+
}
4621
}
4722
}

.devcontainer/setup.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
go install github.com/go-task/task/v3/cmd/task@latest
4+
5+
sudo apt update
6+
sudo apt install -y python3.10-venv
7+
8+
# Mkdocs Social Cards Native Dependencies
9+
sudo apt install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev

.github/workflows/docker_hub.yml

+23-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ on:
1010
branches:
1111
- master
1212
- development
13+
paths-ignore:
14+
- "docs/**"
1315
tags:
14-
- 'v*.*.*'
16+
- "v*.*.*"
1517

1618
jobs:
1719
build:
@@ -20,6 +22,14 @@ jobs:
2022
steps:
2123
- name: Checkout Repository
2224
uses: actions/checkout@v3
25+
26+
- name: Set Docker Platforms For Branch
27+
run: |
28+
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
29+
echo "DOCKER_PLATFORMS=linux/amd64,linux/arm64,linux/arm" >> "$GITHUB_ENV"
30+
else
31+
echo "DOCKER_PLATFORMS=linux/amd64" >> "$GITHUB_ENV"
32+
fi
2333
2434
- name: Set Docker Metadata
2535
id: meta
@@ -28,6 +38,7 @@ jobs:
2838
# list of Docker images to use as base name for tags
2939
images: |
3040
evanbuss/openbooks
41+
ghcr.io/${{ github.repository }}
3142
# generate Docker tags based on the following events/attributes
3243
# 'latest' when push to master with tag
3344
# 'edge' when push to development
@@ -37,7 +48,7 @@ jobs:
3748
tags: |
3849
type=semver,pattern={{version}}
3950
type=edge,branch=development
40-
51+
4152
- name: Set up QEMU
4253
uses: docker/setup-qemu-action@v2
4354

@@ -51,14 +62,21 @@ jobs:
5162
- name: Login to Docker Hub
5263
uses: docker/login-action@v2
5364
with:
54-
username: ${{ secrets.DOCKER_USERNAME }}
55-
password: ${{ secrets.DOCKER_HUB_TOKEN }}
65+
username: ${{ secrets.DOCKER_USERNAME }}
66+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
67+
68+
- name: Login to GitHub Container Registry
69+
uses: docker/login-action@v2
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
5674

5775
- name: Build and Push
5876
uses: docker/build-push-action@v3
5977
with:
6078
context: .
61-
platforms: linux/amd64,linux/arm64,linux/arm
79+
platforms: ${{ env.DOCKER_PLATFORMS }}
6280
push: true
6381
labels: ${{ steps.meta.outputs.labels }}
6482
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/docs.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
workflow_dispatch:
6+
# Runs on pushes targeting the default branch
7+
push:
8+
paths:
9+
- "docs/**"
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
working-directory: docs
15+
16+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
22+
# Allow one concurrent deployment
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: true
26+
27+
jobs:
28+
# Single deploy job since we're just deploying
29+
deploy:
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v3
37+
- name: Setup Pages
38+
uses: actions/configure-pages@v2
39+
- name: Set up Python
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: "3.10"
43+
- name: Build MkDocs Site
44+
run: |
45+
pip install -r requirements.txt
46+
mkdocs build
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v1
49+
with:
50+
path: "docs/site/"
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v1

.github/workflows/release.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@ jobs:
1818

1919
- uses: actions/setup-go@v2
2020
with:
21-
go-version: "^1.17.0"
21+
go-version: "^1.19.2"
2222
- run: go version
23-
23+
2424
- name: Setup Node.js
2525
uses: actions/setup-node@v3
2626
with:
27-
node-version: 16
27+
node-version: 18
28+
29+
- name: Install Task
30+
uses: arduino/setup-task@v1
2831

2932
- name: Build
30-
run: ./build.sh
33+
run: task release:build
3134

3235
- name: Create Release
3336
uses: softprops/action-gh-release@v1
@@ -38,4 +41,4 @@ jobs:
3841
fail_on_unmatched_files: true
3942
name: Release ${{ github.ref }}
4043
files: |
41-
./build/*
44+
./build/*

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ openbooks
44
!openbooks/
55
*.DS_Store
66
**/dist
7+
.task/
8+
docs/venv/
9+
docs/site/
710
# end persist
811

912

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"yaml.schemas": {
3+
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
4+
}
5+
}

Taskfile.Development.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
tasks:
6+
go-update:
7+
desc: Update Golang dependencies.
8+
cmds:
9+
- go get -u ./..
10+
- go mod tidy
11+
12+
npm-update:
13+
desc: Update Node.JS client side dependencies.
14+
dir: server/app
15+
cmds:
16+
- npx npm-check-updates -i
17+
interactive: true
18+
19+
npm-install:
20+
desc: Install Node.JS client side dependencies.
21+
dir: server/app
22+
cmds:
23+
- npm install
24+
sources:
25+
- package.json
26+
- package-lock.json
27+
28+
mock:
29+
desc: Start Mock Server for Development
30+
dir: cmd/mock_server
31+
cmds:
32+
- go run .
33+
34+
cli:
35+
desc: Run OpenBooks in CLI Mode.
36+
dir: cmd/openbooks
37+
cmds:
38+
- go build
39+
- ./openbooks cli --tls=false --server localhost:6667
40+
41+
server:
42+
desc: Run OpenBooks in Server Mode.
43+
dir: cmd/openbooks
44+
cmds:
45+
- go build
46+
- ./openbooks server --tls=false --server localhost:6667
47+
48+
client:
49+
desc: Run OpenBooks React Client Application in Development Mode.
50+
dir: server/app
51+
cmds:
52+
- npm run dev
53+
54+
desktop:
55+
desc: Run OpenBooks in the experimental desktop mode with a WebView GUI.
56+
dir: cmd/openbooks
57+
cmds:
58+
- go run -tags webview

Taskfile.Documentation.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
tasks:
6+
init:
7+
dir: docs
8+
cmds:
9+
- python3 -m venv venv
10+
- venv/bin/python3 -m pip install -r requirements.txt
11+
12+
serve:
13+
dir: docs
14+
cmds:
15+
- venv/bin/mkdocs serve

Taskfile.Release.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
tasks:
6+
npm-build:
7+
internal: true
8+
dir: server/app
9+
cmds:
10+
- npm ci
11+
- npm run build
12+
13+
build:
14+
desc: Build OpenBooks binaries for all supported platforms.
15+
deps:
16+
- npm-build
17+
dir: cmd/openbooks
18+
cmds:
19+
- go get
20+
- env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./../../build/openbooks.exe
21+
- env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./../../build/openbooks_mac
22+
- env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./../../build/openbooks_mac_arm
23+
- env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./../../build/openbooks_linux
24+
- env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ./../../build/openbooks_linux_arm
25+
26+
build-desktop:
27+
desc: Build OpenBooks in the experimental desktop mode with a WebView GUI.
28+
dir: cmd/openbooks
29+
cmds:
30+
- go build -tags webviews

Taskfile.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
includes:
6+
dev: Taskfile.Development.yaml
7+
docs: Taskfile.Documentation.yaml
8+
release: Taskfile.Release.yaml

cmd/openbooks/cli.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"errors"
5-
"fmt"
65
"log"
76
"os"
87
"strings"
@@ -31,7 +30,7 @@ var cliCmd = &cobra.Command{
3130
Use: "cli",
3231
Short: "Run openbooks from the terminal in interactive CLI mode.",
3332
PersistentPreRun: func(cmd *cobra.Command, args []string) {
34-
cliConfig.Version = fmt.Sprintf("OpenBooks CLI %s", ircVersion)
33+
cliConfig.Version = globalFlags.UserAgent
3534
cliConfig.UserName = globalFlags.UserName
3635
cliConfig.Server = globalFlags.Server
3736
cliConfig.Log = globalFlags.Log

0 commit comments

Comments
 (0)