Skip to content

Commit 3da6269

Browse files
authored
feat(CI): auto preview deploy
* feat: Update deploy compose * feat: Add workflow
1 parent 5d29ae1 commit 3da6269

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This deploys every new commit of the website to https://preview.voidmodding.org/
2+
name: Docker Release (Preview)
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- "dev"
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Log in to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Docker metadata
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: |
37+
ghcr.io/${{ github.repository_owner }}/web
38+
tags: |
39+
type=raw,value=preview
40+
labels: |
41+
org.opencontainers.image.source=${{ github.repository }}
42+
org.opencontainers.image.revision=${{ github.sha }}
43+
org.opencontainers.image.version=preview
44+
45+
- name: Build and push
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: ./
49+
file: ./Dockerfile
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
54+
- name: Summary
55+
run: |
56+
echo "Published image tag: preview"

deployment/compose.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ services:
1515
- "--providers.docker=true"
1616
- "--providers.docker.exposedbydefault=false"
1717
- "--entrypoints.web.address=:80"
18+
- "--entrypoints.web-preview.address=:81"
19+
1820
ports:
1921
- "80:80"
20-
- "443:443"
22+
- "81:81"
2123
volumes:
2224
- /var/run/docker.sock:/var/run/docker.sock:ro
2325

@@ -30,3 +32,13 @@ services:
3032
- "traefik.http.routers.web.rule=Host(`voidmodding.org`)"
3133
deploy:
3234
replicas: 3
35+
36+
preview:
37+
image: ghcr.io/void-modding/web:preview
38+
restart: always
39+
labels:
40+
- "com.centurylinklabs.watchtower.enable=true"
41+
- "traefik.enable=true"
42+
- "traefik.http.routers.web-preview.rule=Host(`preview.voidmodding.org`)"
43+
deploy:
44+
replicas: 1

0 commit comments

Comments
 (0)