-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (46 loc) · 1.6 KB
/
deploy.yml
File metadata and controls
55 lines (46 loc) · 1.6 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
name: Build and Deploy
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
# Use a container-based driver (using BuildKit) to enable cache export.
driver-opts: image=moby/buildkit:master
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Preset Image Name
run: |
echo "IMAGE_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.IMAGE_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max
debug: true
- id: deploy
name: Deploy Image to CapRover
uses: caprover/deploy-from-github@v1.1.2
with:
server: ${{ secrets.CAPTAINROVER_SERVER }}
app: ${{ secrets.CAPTAINROVER_APP_NAME }}
token: ${{ secrets.CAPTAINROVER_APP_TOKEN }}
image: ${{ env.IMAGE_URL }}
- name: Show Deployment Output
run: 'echo "Deployment URL: ${{ steps.deploy.outputs.url }}"'