Skip to content

update readme

update readme #38

Workflow file for this run

name: commit-build
permissions:
contents: write
on:
push:
jobs:
build_wheel:
runs-on: ubuntu-latest
strategy:
matrix:
python: [cpython-3.13]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python with uv
run: uv python install ${{ matrix.python }}
- name: Create venv
run: uv venv
- name: Install project dependencies with uv
run: uv sync
- name: Build distribution with uv
run: uv build
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python }}
path: dist/*.whl
- name: Get package version
id: get_version
run: |
version=$(python ci/get_version.py)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Find built wheel
id: find_wheel
run: |
file=$(ls dist/*.whl | head -n 1)
echo "wheel_path=$file" >> $GITHUB_OUTPUT
echo "wheel_name=$(basename \"$file\")" >> $GITHUB_OUTPUT
- name: Show dist contents (debug)
run: |
echo "PWD: $(pwd)"
ls -la dist || true
- name: Get short SHA
id: get_sha
run: |
short=$(echo $GITHUB_SHA | cut -c1-7)
echo "short_sha=$short" >> $GITHUB_OUTPUT
- name: Rename wheel to include Python version
id: rename_wheel
env:
ORIG: ${{ steps.find_wheel.outputs.wheel_path }}
PYVER: ${{ matrix.python }}
run: |
orig="$ORIG"
if [ -z "$orig" ]; then echo "No wheel found at $ORIG"; exit 1; fi
base=$(basename "$orig")
ext="${base##*.}"
name="${base%.*}"
new="${name}+${PYVER}.${ext}"
cp "$orig" "dist/$new"
echo "wheel_path=dist/$new" >> $GITHUB_OUTPUT
echo "wheel_name=$new" >> $GITHUB_OUTPUT
ls -la dist || true
- name: Get datetime
id: get_datetime
run: |
datetime=$(python -c "import datetime; print(datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))")
echo "datetime=$datetime" >> $GITHUB_OUTPUT
- name: Create prerelease and upload wheel
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: prev-${{ steps.get_version.outputs.version }}-${{ steps.get_datetime.outputs.datetime }}-${{ steps.get_sha.outputs.short_sha }}
name: pre-version ${{ steps.get_version.outputs.version }} ${{ steps.get_datetime.outputs.datetime }} (${{ steps.get_sha.outputs.short_sha }})
prerelease: true
artifacts: ${{ steps.rename_wheel.outputs.wheel_path }}
body: |
**這是測試版,使用github action製作**
- base version: ${{ steps.get_version.outputs.version }}
- 時間: ${{ steps.get_datetime.outputs.datetime }}
- short_github_sha: ${{ steps.get_sha.outputs.short_sha }}
- full_github_sha: ${{ github.sha }}