Skip to content

Commit

Permalink
workflow updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysquid committed Sep 19, 2023
1 parent 2a88102 commit 53ec246
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ on:
workflow_dispatch:

jobs:
dump:
uses: Lysquid/ClubBDManga/.github/workflows/dump.yml@main
deploy:
runs-on: [self-hosted, linux]
environment: Production
env:
DB_NAME: ${{ vars.DB_NAME }}
DB_USER: ${{ vars.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
EMAIL: ${{ vars.EMAIL }}
SITE_URL: ${{ vars.SITE_URL }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
steps:
- uses: actions/checkout@v3
- name: Build, restart docker compose and migrate
run: |
docker compose up --build --detach --remove-orphans
docker exec clubbdmanga-db-1 mariadb-dump -u $DB_USER --password=$DB_PASSWORD $DB_NAME > ~/bdmanga_dump_before.sql
docker compose run app python manage.py migrate
docker exec clubbdmanga-db-1 mariadb-dump -u $DB_USER --password=$DB_PASSWORD $DB_NAME > ~/bdmanga_dump_after.sql
env:
DB_NAME: ${{ vars.DB_NAME }}
DB_USER: ${{ vars.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
EMAIL: ${{ vars.EMAIL }}
SITE_URL: ${{ vars.SITE_URL }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
- name: Build and restart docker compose
run: docker compose up --build --detach --remove-orphans
- name: Migrate
run: docker compose run app python manage.py migrate
4 changes: 3 additions & 1 deletion .github/workflows/dump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ jobs:
- name: Make dump directory
run: mkdir -p ~/$DB_NAME
- name: Dump database
run: docker exec clubbdmanga-db-1 mariadb-dump -u $DB_USER --password=$DB_PASSWORD $DB_NAME > ~/$DB_NAME/$(date +"%Y-%m-%d").sql
run: docker exec clubbdmanga-db-1 mariadb-dump -u $DB_USER --password=$DB_PASSWORD $DB_NAME > ~/$DB_NAME/$(date +"%s").sql
- name: Delete dumps older than 30 days
run: find ~/$DB_NAME -type f -mtime +30 -delete

0 comments on commit 53ec246

Please sign in to comment.