Cap the # of data points in Listening Trends #117
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: CI for Last.fm with Friends | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '.github/workflows/*' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Pull, Build & Deploy | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.13.2] | |
steps: | |
- uses: actions/[email protected] | |
- name: Cache node modules | |
if: "!contains(github.event.head_commit.message, '[BE-only]')" | |
uses: actions/[email protected] | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Setup Node.js v${{ matrix.node-version }} environment | |
if: "!contains(github.event.head_commit.message, '[BE-only]')" | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Create config.ts file for Angular | |
if: "!contains(github.event.head_commit.message, '[BE-only]')" | |
run: | | |
echo 'export const config = { "api_key": "${{ secrets.ANGULAR_API_KEY }}", "api_secret": "${{ secrets.ANGULAR_API_SECRET }}", "project_root": "${{ secrets.ANGULAR_PROJECT_ROOT }}", "api_root": "${{ secrets.ANGULAR_API_ROOT }}", "demo_user": "${{ secrets.ANGULAR_DEMO_USER }}", "admin_username": "${{ secrets.ANGULAR_ADMIN_USERNAME }}" }' > ./src/app/config.ts | |
- name: npm install and ng build | |
if: "!contains(github.event.head_commit.message, '[BE-only]')" | |
run: | | |
npm i | |
npm run build:prod | |
- name: Copy files to server web root | |
if: "!contains(github.event.head_commit.message, '[BE-only]')" | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: root | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
source: "./dist/lastfm-with-friends/*" | |
target: "/usr/share/nginx/lastfm-with-friends/" | |
overwrite: true | |
strip_components: 2 | |
- name: Pull new changes on server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: root | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
script: cd /root/projects/lastfm-with-friends && git pull | |
- name: Run buildjson.sh | |
uses: appleboy/ssh-action@master | |
if: "!contains(github.event.head_commit.message, '[BE-only]')" | |
with: | |
host: ${{ secrets.HOST }} | |
username: root | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
script: cd /root/projects/lastfm-with-friends && . /root/.scripts/buildjson.sh > /usr/share/nginx/lastfm-with-friends/assets/build.json | |
- name: Restart Flask server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: root | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
script: chown -R nginx:nginx /root/projects/lastfm-with-friends/backend && service lfmwf restart |