diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a7104ab --- /dev/null +++ b/.github/workflows/main.yml @@ -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 diff --git a/.github/workflows/ng-env-replace.js b/.github/workflows/ng-env-replace.js new file mode 100644 index 0000000..b706a80 --- /dev/null +++ b/.github/workflows/ng-env-replace.js @@ -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); diff --git a/src/prova.txt b/src/prova.txt new file mode 100644 index 0000000..f17ce5e --- /dev/null +++ b/src/prova.txt @@ -0,0 +1 @@ +file di prova \ No newline at end of file