This file contains hidden or 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: Test github actions # 工作流程的名称 | |
| on: # 什么时候触发 | |
| push: # 当有代码推送时触发 | |
| paths: | |
| - 'db.json' | |
| jobs: # 执行的工作 | |
| run_demo_actions: | |
| runs-on: ubuntu-latest # 在最新版本的 Ubuntu 操作系统环境下运行 | |
| steps: # 要执行的步骤 | |
| - name: Checkout code | |
| uses: actions/checkout@v3 # 用于将github代码仓库的代码拷贝到工作目录中 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 # 用于设置 Python 环境,它允许你指定要在工作环境中使用的 Python 版本 | |
| with: | |
| python-version: '3.9' # 选择要用的Python版本 | |
| - name: Install requirements.txt | |
| run: | # 安装依赖包 | |
| pip install -r ./requirements.txt | |
| - name: Run main.py | |
| run: python build_apps_db.py # 执行py文件 依据自己代码要运行的py情况而定 | |
| - name: read-yaml-file | |
| uses: pietrobolcato/action-read-yaml@1.1.0 | |
| id: read_action_js | |
| with: | |
| config: ${{ github.workspace }}/apps.yaml | |
| - name: use-yaml-file | |
| run: | | |
| echo namespace: ${{ steps.read_action_js.outputs['version'] }} | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.read_action_js.outputs['version'] }} | |
| release_name: ${{ steps.read_action_js.outputs['version'] }} | |
| body: 更新app V${{ steps.read_action_js.outputs['version'] }}. | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./apps.db | |
| asset_name: apps.db | |
| asset_content_type: application/zip |