Several improvements to the Last Played calculation #50
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 Neil's Music Tools" | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '.github/workflows/*' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Pull, Build & Deploy | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.17.0] | |
steps: | |
- uses: actions/[email protected] | |
- name: Cache node modules | |
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 | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Create config.ts file | |
run: | | |
echo 'export const config = { spotify: { clientId: "${{ secrets.SPOTIFY_CLIENT_ID }}", authCodeUrl: "${{ secrets.AUTH_CODE_URL }}", redirectUri: "${{ secrets.SPOTIFY_REDIRECT_URI }}", scopes: { "spotify-album-sort": "${{ secrets.SPOTIFY_SCOPES_LIBRARY_SORT }}", "anniversify": "${{ secrets.SPOTIFY_SCOPES_ANNIVERSIFY }}" }, }, anniversify: { apiRoot: "${{ secrets.ANNIVERSIFY_API_ROOT }}", emailSender: "${{ secrets.ANNIVERSIFY_EMAIL_SENDER }}", vapidPublicKey: "${{ secrets.VAPID_PUBLIC_KEY }}", }, lastfm: { apiKey: "${{ secrets.LASTFM_API_KEY }}" } }' > ./src/app/config/config.ts | |
- name: npm install and ng build | |
run: | | |
npm i | |
npm run build:prod | |
- name: Create and copy backend resources | |
run: | | |
mkdir ./dist/music-tools/resources | |
cp ./resources/spotify_auth.php ./dist/music-tools/resources/ | |
echo '<?php return array( "client_id" => "${{ secrets.SPOTIFY_CLIENT_ID }}", "client_secret" => "${{ secrets.SPOTIFY_CLIENT_SECRET }}", "redirect_uri" => "${{ secrets.SPOTIFY_REDIRECT_URI }}", "prod" => true ); ?>' > ./dist/music-tools/resources/app-config.php | |
- name: Copy files to server web root | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: root | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
source: "./dist/music-tools/*" | |
target: "/usr/share/nginx/tools/" | |
overwrite: true | |
strip_components: 2 |