Merge pull request #50 from SAIG-KMITL/feat/pretest-with-exam-answer #21
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
name: Build and deploy to an VM | |
on: | |
push: | |
branches: | |
- dev | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-and-deploy: | |
runs-on: self-hosted | |
steps: | |
- name: switch to root | |
run: sudo -s | |
- name: Copy Repository | |
uses: actions/checkout@v4 | |
- name: 'Create env file' | |
run: | | |
touch .env | |
echo "NODE_ENV=${{ secrets.NODE_ENV }}" >> .env | |
echo "PORT=${{ secrets.PORT }}" >> .env | |
echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env | |
echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env | |
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> .env | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env | |
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> .env | |
echo "CORS_ALLOW_ORIGIN=${{ secrets.CORS_ALLOW_ORIGIN }}" >> .env | |
echo "JWT_ACCESS_SECRET=${{ secrets.JWT_ACCESS_SECRET }}" >> .env | |
echo "JWT_REFRESH_SECRET=${{ secrets.JWT_REFRESH_SECRET }}" >> .env | |
echo "JWT_ACCESS_EXPIRATION=${{ secrets.JWT_ACCESS_EXPIRATION }}" >> .env | |
echo "JWT_REFRESH_EXPIRATION=${{ secrets.JWT_REFRESH_EXPIRATION }}" >> .env | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env | |
echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env | |
echo "AWS_BUCKET_NAME=${{ secrets.AWS_BUCKET_NAME }}" >> .env | |
echo "ADMIN_EMAIL=${{ secrets.ADMIN_EMAIL }}" >> .env | |
echo "ADMIN_PASSWORD=${{ secrets.ADMIN_PASSWORD }}" >> .env | |
echo "AI_URL=${{ secrets.AI_URL }}" >> .env | |
cat .env | |
- name: Running Docker Compose | |
run: docker compose up -d --build |