Skip to content

Server(Dev)

Server(Dev) #5

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Server(Dev)
env:
PYTHON_VERSION: '3.8'
on:
push:
branches: [ "master" ]
paths:
- 'server/**'
pull_request:
branches: [ "master" ]
paths:
- 'server/**'
# 允许手动触发
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout from GitHub'
uses: actions/checkout@v4
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Restore dependencies
shell: bash
run: |
cd server
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
python -m pip install --upgrade pip
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
- name: Login to Private Harbor
uses: docker/login-action@v2
with:
registry: harbor.hsyhhssyy.net
username: [email protected]
password: ${{ secrets.HARBOR_PUSH_KEY }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: ./server
file: ./server/Dockerfile
push: true
tags: harbor.hsyhhssyy.net/home-esxi/amiyabot-custom-pools-server:latest, harbor.hsyhhssyy.net/home-esxi/amiyabot-custom-pools-server:${{ github.sha }}
- name: Setup kubectl
uses: azure/setup-kubectl@v3
id: install
- name: Write Context
uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.HOMECLOUD_KUBECONFIG }}
id: setcontext
- name: Push to k8s
uses: Azure/k8s-deploy@v4
with:
namespace: amiya-bot
manifests: server/server-full.yaml
images: |
harbor.hsyhhssyy.net/home-esxi/amiyabot-custom-pools-server:${{ github.sha }}
imagepullsecrets: harbor.hsyhhssyy.net