Skip to content

deployment

deployment #112

Workflow file for this run

name: deployment
on:
push:
branches: ["master"]
workflow_dispatch:
jobs:
build:
runs-on: ${{ vars['BUILD_RUNNER_LABEL'] }}
steps:
- uses: actions/checkout@v4
- name: Build
env:
APP_NAME: ${{ secrets.APP_NAME }}
BASE_URL: ${{ secrets.BASE_URL }}
NODE_ENV: production
DOCKER_NETWORK_NAME: ${{ secrets.DOCKER_NETWORK_NAME }}
APP_URLS_TRAEFIK: ${{ secrets.APP_URLS_TRAEFIK }}
DOCKER_INTERNAL_PORT: ${{ secrets.DOCKER_INTERNAL_PORT }}
DOCKER_EXTERNAL_PORT: ${{ secrets.DOCKER_EXTERNAL_PORT }}
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_LABELS: ${{ secrets.LOKI_LABELS }}
run: make build registryUrl=${{ secrets.REGISTRY_URL }} appName=${{ secrets.APP_NAME }}
push_image:
runs-on: ${{ vars['BUILD_RUNNER_LABEL'] }}
needs: [ build ]
steps:
- name: Push the image to the image registry
run: make push-image login=${{ secrets.REGISTRY_LOGIN }} password=${{ secrets.REGISTRY_PASSWORD }} registryUrl=${{ secrets.REGISTRY_URL }} appName=${{ secrets.APP_NAME }}
deploy:
runs-on: ${{ vars['PROD_RUNNER_LABEL'] }}
needs: [ push_image ]
steps:
- uses: actions/checkout@v4
- name: Deploy
env:
APP_NAME: ${{ secrets.APP_NAME }}
BASE_URL: ${{ secrets.BASE_URL }}
NODE_ENV: production
DOCKER_NETWORK_NAME: ${{ secrets.DOCKER_NETWORK_NAME }}
APP_URLS_TRAEFIK: ${{ secrets.APP_URLS_TRAEFIK }}
DOCKER_INTERNAL_PORT: ${{ secrets.DOCKER_INTERNAL_PORT }}
DOCKER_EXTERNAL_PORT: ${{ secrets.DOCKER_EXTERNAL_PORT }}
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_LABELS: ${{ secrets.LOKI_LABELS }}
run: make run login=${{ secrets.REGISTRY_LOGIN }} password=${{ secrets.REGISTRY_PASSWORD }} registryUrl=${{ secrets.REGISTRY_URL }} appName=${{ secrets.APP_NAME }}
clear_cf_cache:
runs-on: ${{ vars['BUILD_RUNNER_LABEL'] }}
needs: [ deploy ]
steps:
- name: Clear Cloudflare cache
run: |
curl -X POST "${{ secrets.CF_CACHE_CLEAR_URL }}" \
-H "Authorization: Bearer ${{ secrets.CF_CACHE_CLEAR_API_KEY }}" \
-H "Content-Type:application/json" \
-d '{"purge_everything": true}'