-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (50 loc) · 1.98 KB
/
deploy.yml
File metadata and controls
65 lines (50 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Build and Deploy Nuxt with Railpack
on:
push:
branches:
- main
- staging
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# 1. Start a standalone BuildKit daemon for Railpack
- name: Start BuildKit Daemon
run: docker run --rm --privileged -d --name buildkit moby/buildkit
# 2. Tell Railpack where the BuildKit daemon is
- name: Set BUILDKIT_HOST
run: echo "BUILDKIT_HOST=docker-container://buildkit" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Convert repository name to lowercase
run: echo "IMAGE_NAME=$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Install Railpack
run: curl -sSL https://railpack.com/install.sh | bash
# 3. Build the image with Railpack (now connected to BuildKit)
- name: Build image with Railpack
run: railpack build . --name ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
# 4. Push the built image directly using Railpack (or Docker)
- name: Push image to GHCR
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
- name: Trigger Dokploy Deployment
if: success()
env:
URL_MAIN: ${{ secrets.DOKPLOY_WEBHOOK_URL_MAIN }}
URL_STAGING: ${{ secrets.DOKPLOY_WEBHOOK_URL_STAGING }}
run: |
BRANCH_UPPER=$(echo "${{ github.ref_name }}" | tr '[:lower:]' '[:upper:]')
ENV_VAR_NAME="URL_${BRANCH_UPPER}"
WEBHOOK_URL="${!ENV_VAR_NAME}"
curl -X GET "$WEBHOOK_URL"