-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (53 loc) · 1.82 KB
/
docker-publish.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
54
55
name: CI/CD
on:
push:
branches:
- master
jobs:
tests:
name: Coding standards and unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install JS dependencies (npm install)
run: npm ci
- name: ESLint (JS)
run: npx eslint
- name: Run unit tests
run: npm test
docker-push:
needs: tests
name: Docker build & push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Check out code
- name: Install buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Login to docker hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build the image
run: |
docker buildx build --push \
--tag koalati/tools-service:latest \
--platform linux/amd64,linux/arm/v7,linux/arm64/v8 .
deploy:
needs: docker-push
name: Digital Ocean re-deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Check out code
- name: curl
uses: wei/curl@v1
with:
args: |
-X POST -H \"Content-Type: application/json\" -H \"Authorization: Bearer ${{ secrets.DIGITALOCEAN_DEPLOY_TOKEN }}\" \"https://api.digitalocean.com/v2/apps/${{ secrets.DIGITALOCEAN_APP_ID }}/deployments\"