Skip to content

Added a little more detail for week leaderboard to be able to differe… #27

Added a little more detail for week leaderboard to be able to differe…

Added a little more detail for week leaderboard to be able to differe… #27

name: Build and Deploy RMFPBot
on:
push:
branches:
- 'main'
jobs:
build_upload:
runs-on: ubuntu-latest
outputs:
push_db: ${{ steps.changed-files.outputs.PUSH_DB }}
image_tag: ${{ steps.tag.outputs.sha }}
steps:
- name: '📥 Checkout Code'
uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: '📝 Check if DB Schema was Changed'
id: changed-files
shell: bash {0}
run: |
set +x
if [ $GITHUB_EVENT_NAME == push ]; then
(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep "prisma/")
if [ $? -eq 0 ]; then
echo "pushing db changes"
echo "PUSH_DB=true" >> "$GITHUB_OUTPUT"
else
echo "no db changes to push"
echo "PUSH_DB=false" >> "$GITHUB_OUTPUT"
fi
fi
- name: '🏷️Set docker tag'
id: tag
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: '🔑 Authenticate With GCP'
id: auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: '☁️ Set Up GCP SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: '🐋🔒 Set Up Docker Auth'
run: 'gcloud auth configure-docker us-east1-docker.pkg.dev'
- name: '🐋📤 Build and Upload Docker Image'
run: |
docker build -t rmfp-bot .
docker tag rmfp-bot us-east1-docker.pkg.dev/rmfp-bot/rmfp-repo/rmfp-bot:latest
docker tag rmfp-bot us-east1-docker.pkg.dev/rmfp-bot/rmfp-repo/rmfp-bot:${{ steps.tag.outputs.sha }}
docker push --all-tags us-east1-docker.pkg.dev/rmfp-bot/rmfp-repo/rmfp-bot
- name: '😴 Sleep to allow GCP to catch up'
run: |
sleep 10
deploy:
needs: build_upload
uses: ./.github/workflows/deploy.yml
with:
environment: ${{ needs.build_upload.outputs.push_db == 'true' && 'stage' || 'prod' }}
push_db: ${{ needs.build_upload.outputs.push_db }}
image_tag: ${{ needs.build_upload.outputs.image_tag }}
should_prune: false
secrets: inherit