Skip to content

Commit

Permalink
feat: add build and deploy workflow for client, server, and docs (#91)
Browse files Browse the repository at this point in the history
* feat: add build and deploy workflow for client, server, and docs

* refactor: remove build command and related environment variables from documentation
  • Loading branch information
chimpdev authored Oct 23, 2024
1 parent e6ea3b3 commit 74e68c4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 54 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'Build and Deploy'

on:
workflow_dispatch:
push:
branches: [main]

jobs:
build-and-deploy-client:
name: Build and Deploy /client
if: "${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'chore(build/client): trigger build action') }}"
runs-on: ubuntu-latest

steps:
- name: Connect to SSH and run commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
./build-client.sh
build-and-deploy-server:
name: Build and Deploy /server
if: "${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'chore(build/server): trigger build action') }}"
runs-on: ubuntu-latest

steps:
- name: Connect to SSH and run commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
./build-server.sh
build-and-deploy-docs:
name: Build and Deploy /docs
if: "${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'chore(build/docs): trigger build action') }}"
runs-on: ubuntu-latest

steps:
- name: Connect to SSH and run commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
./build-docs.sh
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ WEBHOOKS_PROXY_SERVER_PASSWORD=
| `HEARTBEAT_ID_DAILY_DATABASE_BACKUP` | Heartbeat ID for daily database backup. (not required) |
| `DISCORD_BOT_GET_APPROXIMATE_GUILD_COUNT_API_URL` | Base API URL for getting approximate guild count of a bot. (not required) |
| `DISCORD_BOT_GET_APPROXIMATE_GUILD_COUNT_API_SECRET` | Secret key for getting approximate guild count of a bot. (not required) |
| `CLIENT_BUILD_FILE_PATH` | Path for the build.sh file. (not required) |
| `DOCS_BUILD_FILE_PATH` | Path for the build.sh file for the docs. (not required) |
| `WEBHOOKS_PROXY_SERVER_PROTOCOL` | Protocol for the proxy server. |
| `WEBHOOKS_PROXY_SERVER_HOST` | Host for the proxy server. |
| `WEBHOOKS_PROXY_SERVER_PORT` | Port for the proxy server. |
Expand All @@ -196,8 +194,6 @@ WEBHOOKS_PROXY_SERVER_PASSWORD=
> - The `LEMON_SQUEEZY_API_KEY` is used for authenticating requests to the Lemon Squeezy API. This is not required for self-hosting. We use Lemon Squeezy for our payment system. Refer to the [Lemon Squeezy Developer Guide](https://docs.lemonsqueezy.com/guides/developer-guide/getting-started#create-an-api-key) to get your API key.
> - Values starting with `HEARTBEAT_ID_` are used for the heartbeat IDs for the heartbeats. We use [Better Stack Uptime](https://betterstack.com/uptime) for monitoring the uptime of the website.
> - The `DISCORD_BOT_GET_APPROXIMATE_GUILD_COUNT_API_URL` and `DISCORD_BOT_GET_APPROXIMATE_GUILD_COUNT_API_SECRET` values are used for getting the approximate guild count of a bot. This is half required for self-hosting. If you don't want to use this feature, you can leave these values empty, but this will result in bots not being able to update server_count using the API. For now, we use private API for this because Discord doesn't provide an official API for getting the approximate guild count of a bot. We don't want to share this API source code with everyone.
> - The `CLIENT_BUILD_FILE_PATH` value is used for the path of the build.sh file. We call this file when we want to build the client with /build command in the base guild. This is not required for self-hosting. This file basically runs the `pnpm build` command in the client directory. Create your own build.sh file and set the path of this file to this value.
> - The `DOCS_BUILD_FILE_PATH` value is used for the path of the build.sh file for the docs. We call this file when we want to build the docs with /build command in the base guild. This is not required for self-hosting. This file basically runs the `pnpm build` command in the docs directory. Create your own build.sh file and set the path of this file to this value.
> - The `WEBHOOKS_PROXY_SERVER_PROTOCOL`, `WEBHOOKS_PROXY_SERVER_HOST`, `WEBHOOKS_PROXY_SERVER_PORT`, `WEBHOOKS_PROXY_SERVER_USERNAME`, and `WEBHOOKS_PROXY_SERVER_PASSWORD` values are used for the proxy server settings. We use a proxy server for sending webhooks requests. If you don't want to use a proxy server, you can leave these values empty. Username and password are not required for the proxy server.
### About Configuration File (Client)
Expand Down
2 changes: 0 additions & 2 deletions server/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ LEMON_SQUEEZY_API_KEY=

DISCORD_BOT_GET_APPROXIMATE_GUILD_COUNT_API_URL=
DISCORD_BOT_GET_APPROXIMATE_GUILD_COUNT_API_SECRET=
CLIENT_BUILD_FILE_PATH=
DOCS_BUILD_FILE_PATH=

# Proxy Configuration
WEBHOOKS_PROXY_SERVER_PROTOCOL=
Expand Down
48 changes: 0 additions & 48 deletions server/src/bot/commands/admin/build.js

This file was deleted.

0 comments on commit 74e68c4

Please sign in to comment.