Skip to content

Commit

Permalink
ci: 检查标签和项目版本是否一致
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Sep 22, 2023
1 parent dce8d6c commit 86336a3
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Release

on:
release:
types: [published]
push:
tags:
- v*

jobs:
release:
Expand All @@ -11,12 +12,32 @@ jobs:
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: he0119/setup-python@main

- 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
run: poetry build

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Upload Release Asset
run: gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 86336a3

Please sign in to comment.