tetst #5
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: Node.js CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
node-version: [21.x] | |
steps: | |
- run: systemctl stop nginx | |
# - run: killall node | |
# - run: docker container kill $(docker container ls -q) | |
- run: cd backend | |
- run: cd soc_docker_service | |
- run: docker-compose up -d db redis | |
- run: sleep 5 | |
- run: docker-compose up -d | |
- run: sleep 5 | |
- run: cd .. | |
- name: Create .env with Github Secrets and run script | |
run: | | |
touch .env | |
echo PORT=$ENV_VAR_1 >> .env | |
echo COMPILER_PORT=$ENV_VAR_2 >> .env | |
echo DB_HOST=$ENV_VAR_3 >> .env | |
echo DB_PORT=$ENV_VAR_4 >> .env | |
echo DB_USER=$ENV_VAR_5 >> .env | |
echo DB_PASSWORD=$ENV_VAR_6 >> .env | |
echo DB_NAME=$ENV_VAR_7 >> .env | |
env: | |
ENV_VAR_1: ${{ secrets.ENV_VAR_1 }} | |
ENV_VAR_2: ${{ secrets.ENV_VAR_2 }} | |
ENV_VAR_3: ${{ secrets.ENV_VAR_3 }} | |
ENV_VAR_4: ${{ secrets.ENV_VAR_4 }} | |
ENV_VAR_5: ${{ secrets.ENV_VAR_5 }} | |
ENV_VAR_6: ${{ secrets.ENV_VAR_6 }} | |
ENV_VAR_7: ${{ secrets.ENV_VAR_7 }} | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: npm install | |
- run: npm start & | |
- run: sleep 5 | |
- run: cd ../frontend | |
- name: Create .env with Github Secrets and run script | |
run: | | |
touch .env | |
echo REACT_APP_COMPILATION_URL=$ENV_VAR_11 >> .env | |
echo REACT_APP_GOOGLE_AUTH=$ENV_VAR_22 >> .env | |
echo REACT_APP_CODEDB=$ENV_VAR_33 >> .env | |
echo REACT_APP_AUTH0_DOMAIN=$ENV_VAR_44 >> .env | |
echo REACT_APP_AUTH0_CLIENT_ID=$ENV_VAR_55 >> .env | |
echo REACT_APP_CLIENT_URL=$ENV_VAR_66 >> .env | |
env: | |
ENV_VAR_11: ${{ secrets.ENV_VAR_11 }} | |
ENV_VAR_22: ${{ secrets.ENV_VAR_22 }} | |
ENV_VAR_33: ${{ secrets.ENV_VAR_33 }} | |
ENV_VAR_44: ${{ secrets.ENV_VAR_44 }} | |
ENV_VAR_55: ${{ secrets.ENV_VAR_55 }} | |
ENV_VAR_66: ${{ secrets.ENV_VAR_66 }} | |
- run: npm install | |
- run: npm run build | |
- run: systemctl start nginx |