Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #282 from luzhongyang/main
Browse files Browse the repository at this point in the history
test release_webapi.yml
  • Loading branch information
QuantYork committed Dec 3, 2021
2 parents 47c6306 + 44400dc commit 9021cb1
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions .github/workflows/release_webapi.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: Release DongTai WebApi
name: Release DongTai WebApi

on:
push:
Expand Down Expand Up @@ -36,16 +36,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-prod.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Checkout
uses: actions/checkout@v2

Expand All @@ -66,6 +63,28 @@ jobs:
VERSION=`echo ${GITHUB_REF##*/} | awk -F'-' '{print $2}'`
echo "::set-output name=version::$VERSION"
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.2
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Generate version file
run: |
cd ${{ github.workspace }} && \
echo "${{ github.event.repository.name }},version,${{ steps.release.outputs.version }}" >> version.txt && \
echo "${{ github.event.repository.name }},commit_hash,${GITHUB_SHA}" >> version.txt \
- name: Upload version file
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: version.txt
asset_name: version.txt
asset_content_type: text/plain

- name: Build and push
uses: docker/build-push-action@v2
with:
Expand All @@ -75,18 +94,18 @@ jobs:
dongtai/dongtai-webapi:latest
dongtai/dongtai-webapi:${{ steps.release.outputs.version }}
- name: deploy Webapi to PROD
uses: wahyd4/kubectl-helm-action@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: |
find deploy/deploy-dongtai-webapi-prod.yml -type f -exec sed -i 's/VERSION/${{ steps.release.outputs.version }}/g' {} \;
ls deploy/deploy-dongtai-webapi-prod.yml | xargs -I {} kubectl apply -f {}
- name: finish build
uses: joelwmale/webhook-action@master
with:
url: ${{ secrets.WEBHOOK_URL }}
body: '{"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:构建完成\n项目:${{github.repository}}\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\nSHA-1:${{github.sha}}\n","tag": "lark_md"}}]}}'
# - name: deploy Webapi to PROD
# uses: wahyd4/kubectl-helm-action@master
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: |
# find deploy/deploy-dongtai-webapi-prod.yml -type f -exec sed -i 's/VERSION/${{ steps.release.outputs.version }}/g' {} \;
# ls deploy/deploy-dongtai-webapi-prod.yml | xargs -I {} kubectl apply -f {}
#
#
# - name: finish build
# uses: joelwmale/webhook-action@master
# with:
# url: ${{ secrets.WEBHOOK_URL }}
# body: '{"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:构建完成\n项目:${{github.repository}}\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\nSHA-1:${{github.sha}}\n","tag": "lark_md"}}]}}'

0 comments on commit 9021cb1

Please sign in to comment.