Skip to content

Deploy

Deploy #22

Workflow file for this run

name: Deploy
on:
pull_request:
branches: [master]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
TAG: v12.0-b25f3fb
jobs:
build-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: paritytech/substrate-telemetry
ref: ${{ env.TAG }}
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
backend -> target
- name: Build backend
run: cd backend && cargo b -r
- name: Prepare artifacts
run: |
mkdir -p artifact
cp -fv backend/target/release/telemetry_core artifact/
cp -fv backend/target/release/telemetry_shard artifact/
cd artifact
strip telemetry_core || true
strip telemetry_shard || true
- name: Upload artifacts
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v3
with:
path: artifact
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
repository: paritytech/substrate-telemetry
ref: ${{ env.TAG }}
path: substrate-telemetry
- name: Update source files
run: |
cp -rvf frontend/* substrate-telemetry/frontend
find substrate-telemetry/frontend/src -name "*.css" -type f -exec sed -ie 's/#e6007a/#00a87a/g' {} \;
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
cache-dependency-path: 'substrate-telemetry/frontend/package-lock.json'
- name: Build frontend
run: |
cd substrate-telemetry/frontend && yarn && yarn build
mv -vf build html
tar -cvJf frontend-html.tar.xz html
- name: Prepare artifacts
run: |
mkdir -p artifact
cp -fv substrate-telemetry/frontend/frontend-html.tar.xz artifact/
- name: Upload artifacts
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v3
with:
path: artifact
upload:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
needs: [build-backend, build-frontend]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v2
- name: List artifacts
run: |
pwd
ls -la artifact
- name: Deploy
uses: dawidd6/action-ansible-playbook@v2
with:
directory: ansible
playbook: install.yml
key: ${{ secrets.SSH_PRIVATE_KEY }}
options: -u ubuntu
inventory: telemetry.rs