Skip to content

Commit 9511528

Browse files
committed
ci: auto deploy docs
1 parent 990103a commit 9511528

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/cd.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and deploy the docs
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
10+
concurrency:
11+
group: docs
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: self-hosted
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Load docker metadata
24+
id: meta
25+
uses: docker/metadata-action@v5
26+
with:
27+
images: |
28+
ghcr.io/blokmap/blokmap-frontend
29+
tags: |
30+
type=raw,value={{sha}}
31+
type=raw,value=latest
32+
33+
- name: Login to GHCR
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Build and push
44+
uses: docker/build-push-action@v6
45+
with:
46+
file: Dockerfile
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
cache-from: type=registry,ref=ghcr.io/blokmap/blokmap-docs:buildcache
50+
cache-to: type=registry,ref=ghcr.io/blokmap/blokmap-docs:buildcache,mode=max
51+
52+
release:
53+
runs-on: self-hosted
54+
needs: [build]
55+
steps:
56+
- name: Deploy docs
57+
uses: appleboy/ssh-action@v1.2.1
58+
with:
59+
host: ${{ secrets.PRODUCTION_HOST }}
60+
username: ${{ secrets.PRODUCTION_USERNAME }}
61+
key: ${{ secrets.PRODUCTION_SSH_KEY }}
62+
debug: true
63+
script: |
64+
set -e
65+
docker compose -f /home/blokmap/deploy/production/compose.prod.yaml pull
66+
docker compose -f /home/blokmap/deploy/production/compose.prod.yaml up blokmap-prod-docs

0 commit comments

Comments
 (0)