Skip to content

调整润色

调整润色 #107

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
environment: PROD
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Tencent Clouds Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.TENCENT_YUN_REGISTRY_HOST }}
username: ${{ secrets.TENCENT_YUN_REGISTRY_USERNAME }}
password: ${{ secrets.TENCENT_YUN_REGISTRY_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
${{ secrets.TENCENT_YUN_REGISTRY_HOST }}/${{ github.repository }}:latest
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
build-args: |
SITE_HOSTNAME=${{ secrets.INGRESS_HOST }}
CORS_HOSTNAME=cors.${{ secrets.INGRESS_HOST }}
deploy:
if: github.ref_name == 'master'
container: ghcr.io/${{ github.repository }}:deployer
runs-on: ubuntu-latest
environment: PROD
needs: build
env:
REPOSITORY: ${{ github.repository }}
INGRESS_HOST: ${{ secrets.INGRESS_HOST }}
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
FRPC_CONFIG: ${{ secrets.FRPC_CONFIG}}
steps:
- uses: actions/checkout@v2
- name: Deploy to self-hosted server
run: |
# generate kubeconfig
echo "${KUBE_CONFIG}" | base64 -d > kubeconfig.yaml
# render deploy configuration
cat runtime/blog.yaml | /root/envsubst > /tmp/blog.yaml
cat runtime/cors-anywhere.yaml | /root/envsubst > /tmp/cors-anywhere.yaml
# 部署资源
/root/kubectl --kubeconfig=./kubeconfig.yaml apply -f /tmp/blog.yaml
/root/kubectl --kubeconfig=./kubeconfig.yaml apply -f /tmp/
cat runtime/ingress.yaml | /root/envsubst > /tmp/ingress.yaml.yaml