huangwb8 / m2w

Automatically upload and update local markdown to WordPress via Python
https://pypi.org/project/m2w/
MIT License
42 stars 14 forks source link

github action: publish package #14

Closed RexWzh closed 6 months ago

RexWzh commented 1 year ago

参数说明:

name: Publish Package # Github 容器名称

on: # 创建 tag 时触发 action
  push:
    tags:
      - '*'

jobs:
  build-and-publish:
    runs-on: ubuntu-latest # 在 ubuntu 上构建
    steps:
      - uses: actions/checkout@v2
      # 检查更新的 tag 是否与 setup 的版本号一致,否则结束
      - name: Verify tag matches setup.py version
        run: |
          if [[ "$(git describe --tags)" != "$(grep "^VERSION" setup.py | cut -d"'" -f2)" ]]; then echo "Tag does not match setup.py version"; exit 0; fi
      - name: Set up Python 3.8 # 创建 Python 容器
        uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - name: Install dependencies # 安装 pip 以及 Pypi 的工具
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine
      - name: Build and publish to PyPI
        env: # 从 仓库 Secret 里读取变量
          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
        run: | # 执行构建脚本
          python setup.py sdist bdist_wheel
          twine check dist/*
          twine upload dist/* --skip-existing
RexWzh commented 1 year ago

这个 PR 可以挂着~

huangwb8 commented 1 year ago

这个 PR 可以挂着~

谢谢大佬 (ฅ´ω`ฅ) 我也学习下 哈哈!