Skip to content

Commit

Permalink
Major simplification of deploy and release
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhsm committed Jan 16, 2025
1 parent eb1c6b9 commit 1ac867e
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 143 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy Junior

on:
push:
branches:
- main
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install flyctl
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Dispatch deploy
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

# TODO: Consider Fly.io release command
- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun run sync

- name: Deploy commands
run: bun run commands
env:
PROD_TOKEN: ${{ secrets.BOT_TOKEN }}
18 changes: 0 additions & 18 deletions .github/workflows/fly-deploy.yml

This file was deleted.

67 changes: 0 additions & 67 deletions .github/workflows/release.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/test.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.vscode
version.txt

# Logs
logs
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM oven/bun:alpine

WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile --production
RUN bun run sync
COPY . .

CMD ["bun", "run", "junior.js"]
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# junior
Non-C Junior: Automating the life's work of MVP community member Non Creative Guy. *Supplies helpful information and guides to players upon a phrase in the Discord, amongst other helpful things*

### Deploy and release a new version
- Make desired changes/commits
- Create a new release via GitGub, naming the tag in the example format 1.0.0
- Github action Deploy will trigger, building the image, pushing it to GHCR and finally will redeploy it.
- Voila, bot is now updated in Discord. Check with /version
### Deploy a new version
- Push changes to main
- Wait for workflow
- Done

### Necessary Environment Variables
#### For running the bot
Expand Down
Binary file modified bun.lockb
Binary file not shown.
24 changes: 0 additions & 24 deletions commands/version.js

This file was deleted.

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
junior:
junior-dev:
image: ghcr.io/twohoursonelife/junior
build:
context: .
Expand Down
7 changes: 2 additions & 5 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
app = "junior"
primary_region = "iad"
swap_size_mb = 512

[build]
image = "ghcr.io/twohoursonelife/junior:latest"
primary_region = "ewr"
swap_size_mb = 256

[[restart]]
policy = "on-failure"
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
"license": "MIT",
"private": true,
"scripts": {
"build": "docker compose build",
"start": "docker compose up --detach",
"build": "docker build -t ghcr.io/twohoursonelife/junior .",
"start": "docker compose up",
"stop": "docker compose down",
"commands": "node deploy-commands.js"
"commands": "bun deploy-commands.js",
"sync": "bun install --frozen-lockfile --production"
},
"dependencies": {
"discord.js": "^14.16.3",
"@discordjs/builders": "^1.9.0"
"discord.js": "^14.17.3",
"@discordjs/builders": "^1.10.0"
},
"devDependencies": {
"eslint": "^9.13.0",
"npm-check-updates": "^17.1.4",
"@discordjs/rest": "^2.4.0",
"discord-api-types": "^0.37.103"
"eslint": "^9.18.0",
"npm-check-updates": "^17.1.13",
"@discordjs/rest": "^2.4.2",
"discord-api-types": "^0.37.116"
}
}

0 comments on commit 1ac867e

Please sign in to comment.