[#475]: deploy to swarm action update #224
Workflow file for this run
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: 'Ligretto build, push and deploy' | |
on: | |
workflow_dispatch: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
- 475-modify-deploy-to-swarm-action-to-use-with-yandex-cloud | |
paths-ignore: | |
- 'apps/gamehub-client/**' | |
- 'apps/blog/**' | |
- '.deploy' | |
- '!.deploy/ligretto.deploy.yml' | |
- '.docker' | |
- '!.docker/Ligretto*' | |
jobs: | |
ligretto-frontend-build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.14' | |
cache: 'yarn' | |
- name: Install yarn | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Build frontend | |
run: yarn run ligretto:front:build | |
env: | |
LIGRETTO_GAMEPLAY_URL: https://api.ligretto.app | |
LIGRETTO_CORE_URL: https://core.ligretto.app/api | |
CAS_PARTNER_ID: 652468293877db2de8390fa3 | |
CAS_STATIC_URL: https://cas.mems.fun/static | |
CAS_URL: https://cas.mems.fun/api | |
AMPLITUDE_TOKEN: f55f6d07422dfb26ca4dfbe59a54d609 | |
- name: Archive frontend production dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend-dist | |
path: | | |
apps/ligretto-frontend/dist | |
ligretto-gameplay-backend-image: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: | | |
ghcr.io/memebattle/ligretto-gameplay-backend:${{ github.sha }} | |
ghcr.io/memebattle/ligretto-gameplay-backend:latest | |
context: '.' | |
file: '.docker/Ligretto-gameplay-backend_Dockerfile' | |
cache-from: type=gha,scope=$GITHUB_REF_NAME-ligretto-gameplay-backend | |
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-ligretto-gameplay-backend | |
ligretto-core-backend-image: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: | | |
ghcr.io/memebattle/ligretto-core-backend:${{ github.sha }} | |
ghcr.io/memebattle/ligretto-core-backend:latest | |
context: '.' | |
file: '.docker/Ligretto-core-backend_Dockerfile' | |
cache-from: type=gha,scope=$GITHUB_REF_NAME-ligretto-core-backend | |
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-ligretto-core-backend | |
deploy: | |
needs: [ligretto-gameplay-backend-image, ligretto-core-backend-image, ligretto-frontend-build] | |
runs-on: ubuntu-22.04 | |
environment: | |
name: Ligretto-production | |
url: https://ligretto.app | |
steps: | |
- uses: actions/checkout@main | |
name: Checkout | |
- name: Download frontend dist | |
id: download_frontend_dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: frontend-dist | |
path: apps/ligretto-frontend/dist | |
- uses: ./.github/actions/deploy-to-swarm | |
name: Deploy to swarm lambda | |
with: | |
path-to-stack: '.deploy/ligretto.deploy.yml' | |
name: 'LIGRETTO' | |
yc_folder_id: ${{ vars.YC_FOLDER_ID }} | |
sa_auth_key: ${{ secrets.YC_WORKER_KEY }} | |
docker_registry_login: ${{ secrets.GHCR_USER }} | |
docker_registry_password: ${{ secrets.GHCR_PULL_TOKEN }} | |
docker_registry: 'ghcr.io' | |
- uses: ./.github/actions/deploy-to-s3 | |
name: Deploy to s3 | |
with: | |
path-to-folder: apps/ligretto-frontend/dist | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
bucket: 'ligretto.app' | |