-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (43 loc) · 1.15 KB
/
build.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
name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
container:
image: rustlang/rust:nightly
steps:
- uses: actions/checkout@v3
- name: Fix permission
run: git config --global --add safe.directory $PWD
- name: test
run: cargo test
build:
needs: test
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build -t aitjcize/crypto-quote-server:latest .
- name: Push Docker image
run: docker push aitjcize/crypto-quote-server:latest
deploy:
needs: build
runs-on: ubuntu-latest
container:
image: google/cloud-sdk:latest
steps:
- uses: actions/checkout@v3
- name: Deploy
run: ./bin/deploy.sh
env:
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}