Skip to content

compile and deploy

compile and deploy #3

name: compile and deploy
on:
workflow_dispatch:
jobs:
complie:
name: compile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
ref: ${{ github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/requirements.txt
pip install mike==1.1.2
python -m pip install --upgrade pip setuptools wheel
- name: Config Git
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
- name: Build
run: |
git fetch origin deploy:deploy
mike deploy --push --branch deploy --rebase ${{ github.ref_name }}
mike set-default -b deploy ${{ github.ref_name }}
deploy:
name: deploy
runs-on: ubuntu-latest
needs: complie
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
ref: deploy
- name: Install ossutil
run: |
sudo -v ; curl https://gosspublic.alicdn.com/ossutil/install.sh | sudo bash
- name: Deploy OSS
env:
ACCESS_KEY_ID: ${{ secrets.SQLBOT_OSS_AK }}
ACCESS_KEY_SECRET: ${{ secrets.SQLBOT_OSS_SK }}
ACCESS_KEY_BUCKET: ${{ secrets.SQLBOT_OSS_BUCKET }}
run: |
ossutil cp -r -f ./${{ github.ref_name }}/ oss://$ACCESS_KEY_BUCKET/ --access-key-id=$ACCESS_KEY_ID --access-key-secret=$ACCESS_KEY_SECRET --endpoint=oss-cn-zhangjiakou.aliyuncs.com --exclude '.git*'