Skip to content
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Build
run: |
npm install -g @angular/cli
npm install
node ./.github/workflows/ng-env-replace.js
ng build --prod --base-href="/redis-patterns-console/"
env:
REDIS_SERVER_API_WS: ${{ secrets.REDIS_SERVER_API_WS }}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v2
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages
FOLDER: dist
7 changes: 7 additions & 0 deletions .github/workflows/ng-env-replace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require('fs');

const targetPath = './src/environments/environment.prod.ts';
const file = fs.readFileSync(targetPath ,'utf8');
const newFile = file.replace('REDIS_SERVER_API_WS', process.env.REDIS_SERVER_API_WS);

fs.writeFileSync(targetPath , newFile);
1 change: 1 addition & 0 deletions src/prova.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file di prova