Browse Source

增加两个 artifact 使用样例

liuyuqi-dellpc 4 years ago
parent
commit
1fc548a5e8

+ 58 - 0
docker/.github/workflows/vue_deploy.yml

@@ -0,0 +1,58 @@
+name: Vue Project Deploy With Docker Image
+
+on:
+  push:
+    branches: [ master ]
+    paths-ignore:
+      - '**/README.md'
+      - '**/*.yml'
+    tags: [release-v*]
+  pull_request:
+    branches: [master]
+
+jobs:
+  build_vue:
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: front
+      strategy:
+        matrix:
+          node-version: [12.x]
+    
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: User Node.js ${{natrix.node-version}}
+        users: actions/setup=node@v1
+        with:
+          node-version: ${{matrix.node-version}}
+      
+      - name: npm Build
+        run: |
+          npm install
+          npn run build
+      
+      - uses: actions/upload-artifact@v2
+        with:
+          name: distfile
+          path: front/dist
+
+  docker_image:
+    needs: [build_vue]
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - uses: actions/download-artifact@v2
+        with:
+          name: distfile
+          path: wwwroot
+      - name: Push to Docker Hub
+        uses: docker/build-push-acation@v1
+        with:
+          username: ${{secrets.DOCKER_HUB_NAME}}
+          password: ${{secrets.DOCKER_HUB_PASSWORD}}
+          repository: jianboy/vue_demo
+          tags: test

+ 1 - 1
dotnet/.github/workflows/main.yml

@@ -1,4 +1,4 @@
-name: CI
+name: Publish donet project to nuget
 on:
   push:
     branches: [ master ]

+ 59 - 0
dotnet/.github/workflows/push_to_docker.yml

@@ -0,0 +1,59 @@
+name: publish donet project to Dokcer Hub
+
+on:
+  push:
+    branches: [ master ]
+    paths-ignore: 
+      - '**/README.md'
+      - '**/*.yml'
+  pull_request:
+    branches: [ master ]
+
+jobs:
+  build-reactapp:
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: AgileConfig.Server.UI/react-ui-antd
+    strategy:
+      matrix:
+        node-version: [12.x]
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Use Node.js ${{ matrix.node-version }}
+      uses: actions/setup-node@v1
+      with:
+        node-version: ${{ matrix.node-version }}
+        
+    - run: npm install
+    - run: npm run build
+    - uses: actions/upload-artifact@v2
+      with:
+        name: agileconfig-ui
+        path: AgileConfig.Server.UI/react-ui-antd/dist/
+  build-dotnet:
+    needs: build-reactapp
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup .NET Core
+      uses: actions/setup-dotnet@v1
+      with:
+        dotnet-version: 3.1.301
+    - name: Install dependencies
+      run: dotnet restore
+    - name: Build
+      run: dotnet build --configuration Release --no-restore
+    - uses: actions/download-artifact@v2
+      with:
+        name: agileconfig-ui
+        path: AgileConfig.Server.Apisite/wwwroot/ui
+    - name: Push to Docker Hub
+      uses: docker/build-push-action@v1
+      with:
+        username: ${{ secrets.DOCKER_HUB_NAME }}
+        password: ${{ secrets.DOCKER_HUB_PASSWORD }}
+        repository: kklldog/agile_config
+        tags: test