mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 15:20:21 +00:00
69 lines
2.1 KiB
YAML
69 lines
2.1 KiB
YAML
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 }}" }'
|