Merge pull request #266 from kac89/dev #173
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: BUILD PROD | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: cmd add version | |
run: cd src;echo "export const version = { number:'${GITHUB_SHA}'}" > version.ts | |
- name: npm install and npm run build | |
run: | | |
npm i --force | |
npm run build -- -c production | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: deploy_dist | |
path: dist | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
token: ${{ secrets.TOKEN }} | |
- name: Download build | |
uses: actions/[email protected] | |
with: | |
name: deploy_dist | |
path: . | |
- name: cmd run | |
run: ls -la | |
- name: Angular create 404.html | |
run: cd vulnrepo-app;cp index.html 404.html;ls -la | |
- name: Add CNAME | |
run: cd vulnrepo-app;echo "vulnrepo.com" > CNAME;ls -la | |
- name: Add README.md | |
run: cd vulnrepo-app;printf "# vulnrepo-build-prod\n\nAutomatic build of the https://github.com/kac89/vulnrepo application." > README.md | |
- name: Commit build | |
run: | | |
cd vulnrepo-app | |
git init | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '[email protected]' | |
git remote add origin https://x-access-token:${{ secrets.TOKEN }}@github.com/kac89/vulnrepo-build-prod.git | |
git add . | |
git commit -m "$(date)" | |
git push -f -u origin master |