feat: delete multiple tasks at once (#262) #242
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: Deploy Namviek | |
on: | |
push: | |
branches: | |
- main | |
# paths-ignore: | |
# - packages/ui-app/** | |
# - packages/shared-ui/** | |
# - packages/goalie-nextjs/** | |
jobs: | |
build-backend-api: | |
runs-on: myvps | |
environment: production | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: create pm2.json file | |
run: | | |
echo '{"apps":[{"name":"kampuni-be","script":"npm","args":"run prod:be"}, {"name":"kampuni-se","script":"npm","args":"run prod:se"}]}' > pm2.json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: install node_modules | |
run: | | |
yarn install | |
yarn generate2 | |
- name: install pm2 for starting nodejs app forever | |
run: npm install pm2 -g | |
- name: build backend source | |
run: | | |
yarn build:be | |
yarn build:se | |
- name: add environment variables | |
run: | | |
date > ./packages/be-gateway/built.time | |
echo "NEXT_PUBLIC_FE_GATEWAY=${{ vars.NEXT_PUBLIC_FE_GATEWAY }} | |
NEXT_PUBLIC_BE_GATEWAY= | |
PORT=${{ vars.PORT }} | |
NEXT_PUBLIC_APP_NAME= | |
MONGODB_URL=${{ vars.MONGODB_URL }} | |
JWT_SECRET_KEY=${{ vars.JWT_SECRET_KEY }} | |
JWT_REFRESH_KEY=${{ vars.JWT_REFRESH_KEY }} | |
JWT_VERIFY_USER_LINK_TOKEN_EXPIRED=${{ vars.JWT_VERIFY_USER_LINK_TOKEN_EXPIRED }} | |
JWT_TOKEN_EXPIRED=${{ vars.JWT_TOKEN_EXPIRED }} | |
JWT_REFRESH_EXPIRED=${{ vars.JWT_REFRESH_EXPIRED }} | |
REDIS_HOST= | |
RESEND_TOKEN=${{ vars.RESEND_TOKEN }} | |
RESEND_EMAIL_DOMAIN=${{ vars.RESEND_EMAIL_DOMAIN }} | |
AWS_ACCESS_KEY=${{ vars.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY=${{ vars.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION=${{ vars.AWS_REGION }} | |
AWS_S3_BUCKET=${{ vars.AWS_S3_BUCKET }} | |
REPLICATE_API_TOKEN=${{ vars.REPLICATE_API_TOKEN }} | |
OPEN_API_KEY=${{ vars.OPEN_API_KEY }} | |
# Pusher beam | |
NEXT_PUBLIC_PUSHER_INSTANCE_ID= | |
PUSHER_INSTANCE_ID=${{ vars.PUSHER_INSTANCE_ID }} | |
PUSHER_SECRET_KEY=${{ vars.PUSHER_SECRET_KEY }} | |
# Pusher channel | |
NEXT_PUBLIC_PUSHER_CHANNEL_APP_KEY=${{ vars.NEXT_PUBLIC_PUSHER_CHANNEL_APP_KEY }} | |
NEXT_PUBLIC_PUSHER_CHANNEL_APP_CLUSTER=${{ vars.NEXT_PUBLIC_PUSHER_CHANNEL_APP_CLUSTER }} | |
PUSHER_CHANNEL_APP_ID=${{ vars.PUSHER_CHANNEL_APP_ID }} | |
PUSHER_CHANNEL_SECRET=${{ vars.PUSHER_CHANNEL_SECRET }} | |
# Livekit | |
LIVEKIT_API_KEY=${{ vars.LIVEKIT_API_KEY }} | |
LIVEKIT_API_SECRET=${{ vars.LIVEKIT_API_SECRET }} | |
NEXT_PUBLIC_LIVEKIT_URL=${{ vars.NEXT_PUBLIC_LIVEKIT_URL }} | |
# Firebase | |
FIREBASE_PROJECT_ID=${{vars.FIREBASE_PROJECT_ID}} | |
FIREBASE_CLIENT_EMAIL=${{vars.FIREBASE_CLIENT_EMAIL}} | |
FIREBASE_PRIVATE_KEY=${{vars.FIREBASE_PRIVATE_KEY}} | |
# Logging | |
AXIOM_DATASET=${{vars.AXIOM_DATASET}} | |
AXIOM_TOKEN=${{vars.AXIOM_TOKEN}} | |
DISCORD_LOG_URL=${{vars.DISCORD_LOG_URL}} | |
" > .env | |
- name: run app | |
run: | | |
pm2 start pm2.json # Tip: At the beginner, pm2 has no service so the `pm2 stop all` will throw an exit code that makes the next command won't be run. So we start all service then stop it and start them again | |
pm2 stop all | |
pm2 start pm2.json | |
- name: finish deployment | |
run: echo 'finish deployment' |