Skip to content

feat: add new authentication error messages in English and Russian fo… #18

feat: add new authentication error messages in English and Russian fo…

feat: add new authentication error messages in English and Russian fo… #18

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
concurrency:
group: production
cancel-in-progress: false
jobs:
test:
name: πŸ§ͺ Test & Build
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v4
- name: πŸ“¦ Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: ⚑ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: πŸ”§ Install dependencies
run: pnpm install --frozen-lockfile
- name: πŸ” Type check
run: pnpm typecheck
- name: πŸ—οΈ Build
run: pnpm build
env:
SKIP_ENV_VALIDATION: 1
NEXTAUTH_SECRET: dummy-secret-for-build
NEXTAUTH_URL: https://localhost:3000
DATABASE_URL: postgresql://dummy:dummy@localhost:5432/dummy
YANDEX_STORAGE_ACCESS_KEY: dummy-access-key
YANDEX_STORAGE_SECRET_KEY: dummy-secret-key
YANDEX_STORAGE_BUCKET: dummy-bucket
YANDEX_STORAGE_REGION: ru-central1
build-and-push:
name: 🐳 Build & Push Image
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
image: ${{ steps.meta.outputs.tags }}
digest: ${{ steps.build.outputs.digest }}
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v4
- name: πŸ”§ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: πŸ”‘ Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest
- name: πŸš€ Build and push
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
deploy:
name: πŸš€ Deploy to Production
needs: build-and-push
runs-on: ubuntu-latest
environment: production
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v4
- name: πŸ”‘ Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: 🌐 Add server to known hosts
run: ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: πŸ“‚ Copy files to server
run: |
scp -r docker-compose.yml traefik/ monitoring/ postgres/ ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:~/exterastore/
- name: πŸ—οΈ Deploy application
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
cd ~/exterastore
docker network create traefik-network 2>/dev/null || true
mkdir -p traefik/acme
chmod 600 traefik/acme
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker compose down
docker compose pull
docker compose up --build -d
docker image prune -f
EOF
- name: βœ… Health check
run: |
sleep 30
curl -f https://exterastore.app/api/health