update meth && remove useless logs #40
Workflow file for this run
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
on: | |
push: | |
tags: | |
- 'v*' | |
name: gateway ci | |
jobs: | |
build-and-deploy: | |
name: Build & Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: Replace secrets for aliyun_oss.yaml | |
run: | | |
sed -i "s/OSS_ACCESS_ENDPOINT/${{ secrets.OSS_ACCESS_ENDPOINT }}/g" ./conf/aliyun_oss.yaml | |
sed -i "s/OSS_ACCESS_KEY_ID/${{ secrets.OSS_ACCESS_KEY_ID }}/g" ./conf/aliyun_oss.yaml | |
sed -i "s/OSS_ACCESS_KEY_SECRET/${{ secrets.OSS_ACCESS_KEY_SECRET }}/g" ./conf/aliyun_oss.yaml | |
- name: Replace secrets for data_platform.yaml | |
run: | | |
sed -i "s/DATA_PLATFORM_ENDPOINT/${{ secrets.DATA_PLATFORM_ENDPOINT }}/g" ./conf/data_platform.yaml | |
- name: Replace secrets for mysql.yaml | |
run: | | |
sed -i "s/DB_IP/${{ secrets.DB_IP }}/g" ./conf/mysql.yaml | |
sed -i "s/DB_PORT/${{ secrets.DB_PORT }}/g" ./conf/mysql.yaml | |
sed -i "s/DB_USER/${{ secrets.DB_USER }}/g" ./conf/mysql.yaml | |
sed -i "s/DB_PASSWD/${{ secrets.DB_PASSWD }}/g" ./conf/mysql.yaml | |
- name: Replace secrets for wx_payment.yaml | |
run: | | |
sed -i "s/TOKEN_WX_APPID/${{ secrets.TOKEN_WX_APPID }}/g" ./conf/wx_payment.yaml | |
sed -i "s/TOKEN_WX_MCHID/${{ secrets.TOKEN_WX_MCHID }}/g" ./conf/wx_payment.yaml | |
sed -i "s/TOKEN_WX_MCH_APIV3/${{ secrets.TOKEN_WX_MCH_APIV3 }}/g" ./conf/wx_payment.yaml | |
sed -i "s/TOKEN_WX_SECRET/${{ secrets.TOKEN_WX_SECRET }}/g" ./conf/wx_payment.yaml | |
sed -i "s/TOKEN_WX_SERIAL_NO/${{ secrets.TOKEN_WX_SERIAL_NO }}/g" ./conf/wx_payment.yaml | |
- name: Build | |
run: | | |
go build | |
mkdir -p output/bin output/conf | |
mv ./grpc-gateway output/bin/ | |
mv ./conf/* output/conf/ | |
- name: Backup old version | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
mv ${{ secrets.DEPLOY_PATH }} ${{ secrets.DEPLOY_PATH }}.$(date +%Y%m%d_%H%M) | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
source: ./output/* | |
target: ${{ secrets.DEPLOY_PATH }} | |
strip_components: 1 | |
restart: | |
name: Restart(TODO) | |
needs: build-and-deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
cd ${{ secrets.DEPLOY_PATH }} | |
ls -al |