fix
Some checks failed
Add-in CI / Build and test Word add-in (push) Failing after 21s
Backend CI + Docker Deploy / Build and test backend (push) Failing after 37s
Web CI / Build and test web app (push) Failing after 5s
Backend CI + Docker Deploy / Build and push backend image (push) Has been skipped
Backend CI + Docker Deploy / Deploy backend container (push) Has been skipped
Some checks failed
Add-in CI / Build and test Word add-in (push) Failing after 21s
Backend CI + Docker Deploy / Build and test backend (push) Failing after 37s
Web CI / Build and test web app (push) Failing after 5s
Backend CI + Docker Deploy / Build and push backend image (push) Has been skipped
Backend CI + Docker Deploy / Deploy backend container (push) Has been skipped
This commit is contained in:
parent
912bf9d0bd
commit
12bb9c9c21
9 changed files with 466 additions and 31 deletions
99
.forgejo/workflows/deploy.yml
Normal file
99
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
name: Deploy Containers
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "addin-*.*.*"
|
||||
- "backend-*.*.*"
|
||||
- "web-*.*.*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY || 'ghcr.io' }}
|
||||
BACKEND_IMAGE: ${{ vars.IMAGE_NAMESPACE }}/word-versioning-backend
|
||||
WEB_IMAGE: ${{ vars.IMAGE_NAMESPACE }}/word-versioning-web
|
||||
BACKEND_TAG: ${{ github.ref_name || 'latest' }}
|
||||
WEB_TAG: ${{ github.ref_name || 'latest' }}
|
||||
DEPLOY_HOST: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
DEPLOY_USER: ${{ vars.SSH_DEPLOY_USER }}
|
||||
|
||||
jobs:
|
||||
build-and-push-backend:
|
||||
name: Build and push backend image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build backend image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./backend/WordVersioning.Api/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ env.BACKEND_TAG }}
|
||||
${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:latest
|
||||
|
||||
build-and-push-web:
|
||||
name: Build and push web image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build web image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./web
|
||||
file: ./web/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.WEB_IMAGE }}:${{ env.WEB_TAG }}
|
||||
${{ env.REGISTRY }}/${{ env.WEB_IMAGE }}:latest
|
||||
|
||||
deploy:
|
||||
name: Deploy to remote host
|
||||
needs:
|
||||
- build-and-push-backend
|
||||
- build-and-push-web
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ env.DEPLOY_HOST }}
|
||||
username: ${{ env.DEPLOY_USER }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
script: |
|
||||
set -e
|
||||
echo "${{ secrets.CONTAINER_REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u "${{ vars.CONTAINER_REGISTRY_USERNAME }}" --password-stdin
|
||||
export BACKEND_IMAGE="${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ env.BACKEND_TAG }}"
|
||||
export WEB_IMAGE="${{ env.REGISTRY }}/${{ env.WEB_IMAGE }}:${{ env.WEB_TAG }}"
|
||||
cd /opt/word-versioning
|
||||
docker compose -f docker-compose.prod.yml pull
|
||||
docker compose -f docker-compose.prod.yml up -d --remove-orphans
|
||||
docker image prune -f
|
||||
Loading…
Add table
Add a link
Reference in a new issue