-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (51 loc) · 1.89 KB
/
build_eugene_web.yml
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
name: Deploy eugene web image from main
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-release-
- name: Build eugene web release
run: cargo build --release
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.EUGENE_WEB_GHCR }}
- name: Build eugene web image
run: |
docker build -t ghcr.io/${{ github.repository}}-web:latest \
-t ghcr.io/${{ github.repository}}-web:$GITHUB_SHA \
-f eugene-web/Dockerfile .
docker push ghcr.io/${{ github.repository}}-web:latest
docker push ghcr.io/${{ github.repository}}-web:$GITHUB_SHA
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token:
${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Create new eugene-web deployment
run: doctl apps create-deployment "${{ secrets.DIGITALOCEAN_APPID }}" --wait --format Progress,Phase,Created,Updated