109 lines
2.8 KiB
YAML
109 lines
2.8 KiB
YAML
name: services/docs - next/required
|
|
|
|
on:
|
|
push:
|
|
branches: [next]
|
|
paths:
|
|
- 'services/docs/**'
|
|
|
|
concurrency:
|
|
group: ci-docs-${{ github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
setup-hugo:
|
|
name: Setup - Hugo
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: 'latest'
|
|
extended: true
|
|
|
|
build-hugo:
|
|
name: Build - Hugo Site
|
|
needs: setup-hugo
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: 'latest'
|
|
extended: true
|
|
|
|
- name: Build Hugo site
|
|
working-directory: services/docs
|
|
run: hugo --gc --minify
|
|
|
|
release-docker:
|
|
name: Release - Docker Image
|
|
needs: build-hugo
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}/docs
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=sha,format=short
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ci/docker/docs/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
deploy:
|
|
name: Deploy - VPS
|
|
needs: release-docker
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/next'
|
|
steps:
|
|
- name: Deploy via SSH
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.DEPLOY_VPS_HOST }}
|
|
username: ${{ secrets.DEPLOY_VPS_USER }}
|
|
key: ${{ secrets.DEPLOY_VPS_SSH_KEY }}
|
|
port: ${{ secrets.DEPLOY_VPS_SSH_PORT || 22 }}
|
|
script: |
|
|
cd /srv/ermnvldmr.com
|
|
git pull
|
|
chmod +x ci/scripts/deploy-new-tags.sh
|
|
# Use the short SHA to match the tag from release-docker
|
|
export DOCS_TAG="sha-$(echo ${{ github.sha }} | cut -c1-7)"
|
|
./ci/scripts/deploy-new-tags.sh
|