You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+85-5Lines changed: 85 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,91 @@ An example workflow provided below, shows how we can automagically create a depl
5
5
6
6
Using this Github Action requires the following three pieces of information to be entered into Github Secrets for your project repository:
7
7
8
-
- APP_NAME secret is the name of your app, exactly as it's specified in Caprover.
9
-
- APP_TOKEN secret is obtained fromt he "Deployment" tab of the app in Caprover. Click "Enable App Token" to generate a token.
10
-
- CAPROVER_SERVER secret can be organization-wide, per project, or per project override and in the format of https://captain.apps.your-domain.com.
8
+
-`app` secret is the name of your app, exactly as it's specified in Caprover.
9
+
-`token` secret is obtained fromt he "Deployment" tab of the app in Caprover. Click "Enable App Token" to generate a token.
10
+
-`server` secret can be organization-wide, per project, or per project override and in the format of https://captain.apps.your-domain.com.
11
+
Optional:
12
+
-`image` secret can be used to specify the specific image you want to deploy, this is particularly useful when you want to build on Github.
13
+
-`branch` secret can be used to specify the branch you want to deploy to CapRover.
14
+
- If `image` and `branch` are empty, this action expects a tar file located at the root of the project `./deploy.tar` to deploy
11
15
12
-
The example workflow contains a few steps to process your source code into a deployed app in Caprover. The first step uses the a CI/CD version of Node Package Manager (NPM) to build the front-end from source code. The second step packages up your newly minted dist/ directory, the existing backend/ directory and captain-definition file into a deploy.tar file. In the last step the deploy.tar file is picked up by this Github Action and using the provided secrets, will send the file to the Caprover server where it will be deployed.
16
+
17
+
18
+
### Example 1 - deploy using image:
19
+
20
+
Specify `CAPROVER_APP_TOKEN` and `CAPROVER_HOST` as secret in your repo. Also change `env` section in the action and you're good to go!
21
+
22
+
23
+
```yaml
24
+
name: Deploy to staging
25
+
26
+
env:
27
+
CONTEXT_DIR: './'
28
+
IMAGE_NAME: ${{ github.repository }}/staging
29
+
DOCKERFILE: Dockerfile.staging
30
+
CAPROVER_APP: myapp-staging
31
+
DOCKER_REGISTRY: ghcr.io
32
+
33
+
on:
34
+
push:
35
+
branches:
36
+
- main
37
+
# you can specify path if you have a monorepo and you want to deploy if particular directory is changed, make sure to update `CONTEXT_DIR` too
The example workflow contains a few steps to process your source code into a deployed app in Caprover. The first step uses the a CI/CD version of Node Package Manager (NPM) to build the front-end from source code. The second step packages up your newly minted dist/ directory, the existing backend/ directory and captain-definition file into a deploy.tar file. In the last step the deploy.tar file is picked up by this Github Action and using the provided secrets, will send the file to the Caprover server where it will be deployed.
91
+
92
+
```yaml
15
93
name: Build App & Deploy
16
94
17
95
on:
@@ -56,6 +134,8 @@ jobs:
56
134
server: '${{ secrets.CAPROVER_SERVER }}'
57
135
app: '${{ secrets.APP_NAME }}'
58
136
token: '${{ secrets.APP_TOKEN }}'
137
+
branch: '${{ secrets.DEPLOY_BRANCH }}'# optional
138
+
image: '${{ secrets.DEPLOY_IMAGE }}'# optional
59
139
60
140
```
61
141
@@ -64,4 +144,4 @@ NOTE: Deployments take place within seconds after the workflow has been processe
64
144
For more information:
65
145
66
146
A complete Vue 3 frontend starter project that includes a PHP backend that uses this Github Action can be found at https://github.com/PremoWeb/SDK-Foundation-Vue/.
67
-
The example workflow presented on this page was sourced from https://github.com/PremoWeb/SDK-Foundation-Vue/blob/main/.github/workflows/deploy.yml.
147
+
The example workflow presented on this page was sourced from https://github.com/PremoWeb/SDK-Foundation-Vue/blob/main/.github/workflows/deploy.yml.
0 commit comments