Skip to content

Commit

Permalink
chore: 更新 GitHub Workflows (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
st1020 authored Nov 3, 2024
1 parent 905246f commit 011fe17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 53 deletions.
36 changes: 5 additions & 31 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,21 @@ inputs:
python-version:
description: Python version
default: '3.12'
sync:
description: Sync the project's dependencies with the environment
default: true
cache:
description: Store dependencies in the cache
default: true

runs:
using: composite
steps:
- name: Set up uv
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash
- name: Set up uv
if: ${{ runner.os == 'Windows' }}
run: irm https://astral.sh/uv/install.ps1 | iex
shell: powershell
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: uv.lock

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Restore uv cache
if: ${{ inputs.sync && inputs.cache }}
uses: actions/cache@v4
with:
path: ${{ runner.os == 'Windows' && 'D:\\uv-cache' || '/tmp/.uv-cache' }}
key: ${{ runner.os }}-${{ runner.arch }}-python-${{ inputs.python-version }}-uv-${{ hashFiles('uv.lock') }}

- name: Install the project
if: ${{ inputs.sync }}
run: uv sync --all-extras --dev
shell: bash
env:
UV_CACHE_DIR: ${{ runner.os == 'Windows' && 'D:\\uv-cache' || '/tmp/.uv-cache' }}

- name: Minimize uv cache
if: ${{ inputs.sync && inputs.cache }}
run: uv cache prune --ci
shell: bash
env:
UV_CACHE_DIR: ${{ runner.os == 'Windows' && 'D:\\uv-cache' || '/tmp/.uv-cache' }}
27 changes: 6 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
build:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -60,25 +62,8 @@ jobs:
- run: uv build -o dist --package alicebot-adapter-mirai
shell: bash

- name: upload windows dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

publish:
runs-on: ubuntu-latest
environment: release
needs:
- build
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- run: uv build -o dist --package alicebot-adapter-telegram
shell: bash

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- run: uv publish
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cancel-in-progress: true
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
env:
Expand Down

0 comments on commit 011fe17

Please sign in to comment.