Merge pull request #136 from linhaojun857/dev #73
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: Aurora CI | |
on: | |
push: | |
branches: ["master"] | |
workflow_dispatch: | |
jobs: | |
aurora-springboot-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "8" | |
distribution: "temurin" | |
cache: "maven" | |
- name: Build with Maven | |
run: | | |
cd aurora-springboot | |
mvn -B package --file pom.xml | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKER_PASSWORD}} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: aurora-springboot | |
tags: ${{secrets.DOCKER_USERNAME}}/aurora-springboot:latest | |
file: aurora-springboot/Dockerfile | |
- name: Update aurora-springboot container | |
run: | |
sshpass -p ${{secrets.REMOTE_HOST_B_PASSWORD}} ssh -o StrictHostKeyChecking=no | |
root@${{secrets.REMOTE_HOST_B_IP}} "cd /usr/local/aurora-springboot && sh aurora-springboot.sh" | |
aurora-vue-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
cache: "npm" | |
cache-dependency-path: "aurora-vue/aurora-*/package-lock.json" | |
- name: Install aurora-blog dependencies | |
run: | | |
cd aurora-vue/aurora-blog | |
npm install | |
- name: Build aurora-blog | |
run: | | |
cd aurora-vue/aurora-blog | |
npm run build | |
- name: Install aurora-admin dependencies | |
run: | | |
cd aurora-vue/aurora-admin | |
npm install | |
- name: Build aurora-admin | |
run: | | |
cd aurora-vue/aurora-admin | |
npm run build | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKER_PASSWORD}} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: aurora-vue | |
tags: ${{ secrets.DOCKER_USERNAME }}/aurora-vue:latest | |
file: aurora-vue/Dockerfile | |
- name: HostB transfer aurora-vue to tencent-registery | |
run: | |
sshpass -p ${{secrets.REMOTE_HOST_B_PASSWORD}} ssh -o StrictHostKeyChecking=no | |
root@${{secrets.REMOTE_HOST_B_IP}} "cd /usr/local/aurora-vue && sh aurora-vue.sh" | |
- name: Update aurora-vue container | |
run: | |
sshpass -p ${{secrets.REMOTE_HOST_A_PASSWORD}} ssh -o StrictHostKeyChecking=no | |
root@${{secrets.REMOTE_HOST_A_IP}} "cd /usr/local/aurora-vue && sh aurora-vue.sh" |