fix: debts export #85
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 | |
on: | |
push: | |
branches: | |
- main | |
env: | |
JOB_STARTED_AT: ${{ github.event.created_at }} | |
CR_REGISTRY: ${{ secrets.CR_REGISTRY }} | |
CR_IMAGE_FRONTEND: ${{ secrets.CR_IMAGE_FRONTEND }} | |
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} | |
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} | |
NEXT_PUBLIC_AUTH_REDIRECT_URL: ${{ secrets.NEXT_PUBLIC_AUTH_REDIRECT_URL }} | |
NEXT_PUBLIC_TELEGRAM_BOT_NAME: ${{ secrets.NEXT_PUBLIC_TELEGRAM_BOT_NAME }} | |
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
jobs: | |
build: | |
runs-on: mn-mirea-debts-runner | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Registry | |
uses: yc-actions/yc-cr-login@v1 | |
with: | |
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} | |
- name: Build and Push Image | |
run: | | |
docker build \ | |
--pull \ | |
--build-arg NEXT_PUBLIC_SUPABASE_URL=${{ env.NEXT_PUBLIC_SUPABASE_URL }} \ | |
--build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ env.NEXT_PUBLIC_SUPABASE_ANON_KEY }} \ | |
--build-arg NEXT_PUBLIC_AUTH_REDIRECT_URL=${{ env.NEXT_PUBLIC_AUTH_REDIRECT_URL }} \ | |
--build-arg NEXT_PUBLIC_TELEGRAM_BOT_NAME=${{ env.NEXT_PUBLIC_TELEGRAM_BOT_NAME }} \ | |
--cache-from cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:latest \ | |
--label "org.image.title=${{ github.repository }}" \ | |
--label "org.image.url=${{ github.repositoryUrl }}" \ | |
--label "org.image.created=${{ env.JOB_STARTED_AT }}" \ | |
--label "org.image.revision=${{ github.ref_name }}" \ | |
--label "org.image.version=${{ github.sha }}" \ | |
--tag cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:${{ github.sha }} \ | |
. | |
docker push cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:${{ github.sha }} | |
docker tag cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:${{ github.sha }} \ | |
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:latest | |
docker push cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:latest | |
deploy: | |
runs-on: mn-mirea-debts-runner | |
needs: [build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Registry | |
uses: yc-actions/yc-cr-login@v1 | |
with: | |
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} | |
- name: Deploy | |
run: | | |
cd ${{ secrets.PRODUCTION_FOLDER }} | |
docker compose --env-file .env.local pull | |
docker compose --env-file .env.local up -d |