-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: github actions - reset demo db daily, update dockerhub image on…
… commit * feat: github action - reset demo db on cron job * feat: github action - update dockerhub image
- Loading branch information
1 parent
ab5a54e
commit 4902c65
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Docker Image Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Log in to DockerHub | ||
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | ||
|
||
- name: Build Docker Image | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aftermath-archive-backend:latest \ | ||
-t ${{ secrets.DOCKERHUB_USERNAME }}/aftermath-archive-backend:${{ github.sha }} . | ||
- name: Push Docker Image to DockerHub | ||
run: | | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aftermath-archive-backend:latest | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aftermath-archive-backend:${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Reset MongoDB Demo Data | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Runs daily at midnight UTC | ||
workflow_dispatch: | ||
|
||
jobs: | ||
reset-db: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Drop and Seed Database | ||
run: npm run db:drop-and-seed | ||
env: | ||
MONGO_URI: ${{ secrets.DATABASE_URL }} |