checkbox disable #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Master CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: npm install, build, lint and test | |
run: | | |
yarn | |
yarn lint | |
yarn build --no-unsafe-inline | |
env: | |
CI: true | |
build: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ecency/hivesigner:latest | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
deploy-production: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH and deploy node app | |
uses: appleboy/ssh-action@5711a203b3207eb1c6cebec6ac2152ab210ec3ae | |
env: | |
STAGING_PORT: ${{secrets.PRODUCTION_PORT}} | |
BROADCAST_NETWORK: ${{secrets.BROADCAST_NETWORK}} | |
BUGSNAG_API_KEY: ${{secrets.BUGSNAG_API_KEY}} | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
port: ${{ secrets.SSH_PORT }} | |
envs: STAGING_PORT,BROADCAST_NETWORK,BUGSNAG_API_KEY | |
script: | | |
cd ~/hivesigner-ui | |
git pull origin main | |
git checkout main | |
docker system prune -a -f | |
export PORT=$STAGING_PORT | |
export BROADCAST_NETWORK=$BROADCAST_NETWORK | |
export BUGSNAG_API_KEY=$BUGSNAG_API_KEY | |
docker pull ecency/hivesigner:latest | |
docker stack deploy -c docker-compose.yml -c docker-compose.production.yml hivesigner-production |