diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..6d16e19 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -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 }} diff --git a/Cargo.lock b/Cargo.lock index 1136427..c635922 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -926,17 +926,12 @@ version = "0.1.0" dependencies = [ "built", "clap", - "diesel", "diesel_migrations", "env_logger", "log", "manifold", "poise", - "rand 0.8.5", - "regex 1.11.1", - "rust-i18n", "tokio", - "url", ] [[package]] @@ -1409,7 +1404,8 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "manifold" -version = "6.1.0" +version = "6.1.1" +source = "git+https://code.orbiter-radio.uk/discord/manifold.git#04cd52f7e494ab905ab9d9d03daeb3efe77ab392" dependencies = [ "built", "chrono", diff --git a/Cargo.toml b/Cargo.toml index b2b841d..c23f99a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,15 +9,10 @@ built = { version = "0.8.0", features = ["git2", "semver", "chrono"] } [dependencies] built = { version = "0.8.0", features = ["git2", "semver", "chrono"] } clap = { version = "4.3.23", features = ["cargo"] } -diesel = { version = "2.1.0", features = ["postgres", "r2d2", "chrono"] } diesel_migrations = "2.1.0" env_logger = "0.10.0" log = "0.4.20" -# manifold = { git = "https://code.orbiter-radio.uk/discord/manifold.git" } -manifold = { path = "/home/xyon/Workspace/manifold/" } +manifold = { git = "https://code.orbiter-radio.uk/discord/manifold.git" } +# manifold = { path = "/home/xyon/Workspace/manifold/" } 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"] } -url = "2.5.2"