Skip to content

Commit

Permalink
Merge pull request #6 from nwplus/automate-deployments
Browse files Browse the repository at this point in the history
Inject Server Secret Files from Github Secrets
  • Loading branch information
lsha0730 authored Jul 19, 2024
2 parents 713d1c0 + 5aaf81b commit eed2c97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,18 @@ jobs:
- name: Copy systemd service file
run: sudo cp dinubot.service /etc/systemd/system/dinubot.service

- name: Create .env file from secret
run: echo "${{ secrets.ENV_FILE }}" > .env

- name: Create service_account.json file from secret
run: echo "${{ secrets.SERVICE_ACCOUNT_JSON }}" > service_account.json

- name: Reload systemd daemon
run: sudo systemctl daemon-reload

- name: Stop existing Dinubot service
run: sudo systemctl stop dinubot

- name: Enable and start Dinubot service
run: |
sudo systemctl enable dinubot
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/refresh_secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Refresh Secrets on Server

on:
workflow_dispatch:

jobs:
restart-service:
runs-on: self-hosted
steps:
- name: Create .env file from secret
run: echo "${{ secrets.ENV_FILE }}" > .env

- name: Create service_account.json file from secret
run: echo "${{ secrets.SERVICE_ACCOUNT_JSON }}" > service_account.json

- name: Restart Dinubot service
run: |
sudo systemctl restart dinubot

0 comments on commit eed2c97

Please sign in to comment.