You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.0 KiB
54 lines
2.0 KiB
name: devops-test
|
|
on:
|
|
push:
|
|
branches: [test]
|
|
workflow_dispatch:
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: ['16.x']
|
|
go-version: ['1.16']
|
|
steps:
|
|
- name: Check out branch
|
|
uses: actions/checkout@v2
|
|
- name: Sed Config
|
|
env:
|
|
PROD: ${{ secrets.PROD }}
|
|
TESTING: ${{ secrets.TESTING }}
|
|
shell: bash
|
|
run: |
|
|
git branch
|
|
ls -l
|
|
sed -i 's/${PROD}/${TESTING}/g' web/.env.production
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v2.1.2
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Build-Node
|
|
run: |
|
|
cd web/ && yarn install && yarn run build
|
|
- name: Use Go ${{ matrix.go-version }}
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Build-go
|
|
run: |
|
|
cd server/ && go mod tidy && go build && mkdir ../web/ser && mv server ../web/ser/ && cd ../web/ser/ && ls -s
|
|
- name: restart
|
|
env:
|
|
KEY: ${{ secrets.KEY }}
|
|
HOST: ${{ secrets.HOST }}
|
|
USER: ${{ secrets.USER }}
|
|
PROT: ${{ secrets.PROT }}
|
|
MKDIRTEST: ${{ secrets.MKDIRTEST }}
|
|
run: |
|
|
mkdir -p ~/.ssh/ && echo "$KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
scp -P ${PROT} -o StrictHostKeyChecking=no -r web/dist/* ${USER}@${HOST}:${MKDIRTEST}dist/
|
|
scp -P ${PROT} -o StrictHostKeyChecking=no -r web/ser/* ${USER}@${HOST}:${MKDIRTEST}
|
|
ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIRTEST}resource/ && rm -rf ${MKDIRTEST}resource/*"
|
|
scp -P ${PROT} -o StrictHostKeyChecking=no -r server/resource/* ${USER}@${HOST}:${MKDIRTEST}resource/
|
|
ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIRTEST} && bash restart.sh > /dev/null 2>&1 &"
|