merge #6
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: Prod Prod CI/CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY_URL: registry.ap-southeast-1.aliyuncs.com # set this to the URL of your registry | |
NAMESPACE: openai | |
ENVIRONMENT: prod | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to ACR | |
uses: aliyun/acr-login@v1 | |
with: | |
login-server: ${{ env.REGISTRY_URL }} | |
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }} | |
password: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }} | |
- uses: docker/setup-buildx-action@v1 | |
- uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{env.REGISTRY_URL}}/neutron/chatgpt:${{ github.sha }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
env: | |
REGISTRY_URL: registry.ap-southeast-1.aliyuncs.com # set this to the URL of your registry | |
NAMESPACE: openai | |
ENVIRONMENT: prod | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
set-safe-directory: false | |
- uses: azure/k8s-set-context@v1 | |
with: | |
method: kubeconfig | |
kubeconfig: ${{ secrets.ALIYUN_KUBECONFIG }} # Use secret (https://developer.github.com/actions/managing-workflows/storing-secrets/) | |
- uses: azure/setup-kubectl@v3 | |
- name: Test AKS | |
run: | | |
kubectl get ns | |
- uses: Azure/k8s-deploy@v4 | |
with: | |
action: deploy | |
namespace: ${{ env.NAMESPACE }} | |
manifests: | | |
.deployment/${{env.ENVIRONMENT}}/deployments/app.yaml | |
.deployment/${{env.ENVIRONMENT}}/services/service.yaml | |
images: | | |
${{env.REGISTRY_URL}}/neutron/chatgpt:${{ github.sha }} | |