-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (56 loc) · 2.06 KB
/
build_prod.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
56
57
58
59
60
61
62
63
64
65
66
67
68
name: build prod
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install
- run: npm run prod
env:
CI: true
### Prepare docker & login to Dockerhub
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
### Set version
- run: echo "VERSION=0.1.${{github.run_number}}" >> $GITHUB_ENV
- run: echo "CONTAINER_TAG=fluencelabs/dashboard:latest,fluencelabs/dashboard:${{ env.VERSION }}" >> $GITHUB_ENV
### Build and push docker image
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./caddy.Dockerfile
push: true
tags: ${{ env.CONTAINER_TAG }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
### Deploy
- name: Invoke deployment workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: deploy prod
token: ${{ secrets.PERSONAL_TOKEN }}
inputs: '{ "version": "${{ env.VERSION }}" }'