From 4b3995206ba12fb227c40ab414a77217530d8ab2 Mon Sep 17 00:00:00 2001 From: MingxuanGame Date: Wed, 4 Oct 2023 12:09:13 +0800 Subject: [PATCH] :construction_worker: add release CI --- .github/workflows/release.yml | 42 +++++++++++++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 43 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..52c12dd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Release + +on: + push: + tags: + - v* + +jobs: + release: + runs-on: ubuntu-latest + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + contents: write + steps: + - uses: actions/checkout@v3 + + - uses: pdm-project/setup-pdm@v3 + with: + python-version: "3.10" + cache: true + cache-dependency-path: ./pdm.lock + + - name: Install dependencies + run: pdm sync + shell: bash + + - name: Get version + id: version + run: | + echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT + echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: Check Version + if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION + run: exit 1 + + - name: Build and Publish package + run: | + pdm publish + gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 6983196..d58a611 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dependencies = [ requires-python = ">=3.8" readme = "README.md" dynamic = ["version"] +keywords = ["onebot", "libonebot", "onebot12"] license = { text = "MIT" } [build-system]