1
0
Fork 0

Add workflows

This commit is contained in:
Lucy Bladen 2025-05-02 23:55:37 +01:00
parent d4a3864a30
commit 1b76998c24
3 changed files with 61 additions and 13 deletions

View File

@ -0,0 +1,57 @@
name: Hal Deployment
run-name: Deploy to prod
on:
push:
branches:
- main
jobs:
build:
runs-on: rust
container:
options: --dns 172.16.255.254
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build (Release)
run: cargo build --release --color=always
- name: Archive artifact
uses: actions/upload-artifact@v3
with:
name: hal
path: target/release/hal
deploy:
runs-on: rust
container:
options: --dns 172.16.255.254
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: hal
- name: Pre-seed known_hosts
run: mkdir -pv ~/.ssh && ssh-keyscan -t rsa $BOT_SERVER_HOSTNAME >> ~/.ssh/known_hosts
env:
BOT_SERVER_HOSTNAME: ${{ vars['HAL_SERVER_HOSTNAME'] }}
- uses: cschleiden/replace-tokens@v1.2
with:
files: config/production.hal.json
env:
BOT_NICKNAME: ${{ vars.BOT_NICKNAME }}
BOT_IDENTIFIER: ${{ vars.SERVER_HOSTNAME }}
LOG_CHANNEL_ID: ${{ vars.LOG_CHANNEL_ID }}
POSTGRES_HOST: ${{ vars.POSTGRES_HOST }}
POSTGRES_USER: ${{ vars.POSTGRES_USER }}
POSTGRES_DATABASE_NAME: ${{ vars.POSTGRES_DATABASE_NAME] }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
WEATHER_API_KEY: ${{ secrets.WEATHER_API_KEY }}
DOGPICS_API_KEY: ${{ secrets.DOGPICS_API_KEY }}
CATPICS_API_KEY: ${{ secrets.CATPICS_API_KEY }}
- name: Seed SSH key for deploy
run: echo "${{ secrets.DEPLOY_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa && chmod 0600 ~/.ssh/id_rsa
- name: Deploy
run: bash cicd/deploy.sh ${{ vars.SERVER_HOSTNAME }}

8
Cargo.lock generated
View File

@ -926,17 +926,12 @@ version = "0.1.0"
dependencies = [ dependencies = [
"built", "built",
"clap", "clap",
"diesel",
"diesel_migrations", "diesel_migrations",
"env_logger", "env_logger",
"log", "log",
"manifold", "manifold",
"poise", "poise",
"rand 0.8.5",
"regex 1.11.1",
"rust-i18n",
"tokio", "tokio",
"url",
] ]
[[package]] [[package]]
@ -1409,7 +1404,8 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]] [[package]]
name = "manifold" name = "manifold"
version = "6.1.0" version = "6.1.1"
source = "git+https://code.orbiter-radio.uk/discord/manifold.git#04cd52f7e494ab905ab9d9d03daeb3efe77ab392"
dependencies = [ dependencies = [
"built", "built",
"chrono", "chrono",

View File

@ -9,15 +9,10 @@ built = { version = "0.8.0", features = ["git2", "semver", "chrono"] }
[dependencies] [dependencies]
built = { version = "0.8.0", features = ["git2", "semver", "chrono"] } built = { version = "0.8.0", features = ["git2", "semver", "chrono"] }
clap = { version = "4.3.23", features = ["cargo"] } clap = { version = "4.3.23", features = ["cargo"] }
diesel = { version = "2.1.0", features = ["postgres", "r2d2", "chrono"] }
diesel_migrations = "2.1.0" diesel_migrations = "2.1.0"
env_logger = "0.10.0" env_logger = "0.10.0"
log = "0.4.20" log = "0.4.20"
# manifold = { git = "https://code.orbiter-radio.uk/discord/manifold.git" } manifold = { git = "https://code.orbiter-radio.uk/discord/manifold.git" }
manifold = { path = "/home/xyon/Workspace/manifold/" } # manifold = { path = "/home/xyon/Workspace/manifold/" }
poise = { version = "0.5.*", features = [ "cache" ] } poise = { version = "0.5.*", features = [ "cache" ] }
rand = { version = "0.8.5", features = [ "small_rng" ] }
regex = "1.9.5"
rust-i18n = "3.1.2"
tokio = { version = "1.16.1", features = ["sync", "macros", "rt-multi-thread"] } tokio = { version = "1.16.1", features = ["sync", "macros", "rt-multi-thread"] }
url = "2.5.2"