-
Notifications
You must be signed in to change notification settings - Fork 14
68 lines (57 loc) · 1.99 KB
/
publish-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish 🐍 📦 to TestPyPI
on:
workflow_dispatch:
jobs:
publish-to-testpypi:
if: github.event_name == 'workflow_dispatch' # Only allow manual triggers
name: Publish 🐍 distribution 📦 to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/parllama
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: |
uv sync
- name: Get version from __init__.py
id: get_version
run: |
version=$(uv run python -c "from src.parllama import __version__; print(__version__)")
echo "Raw version output: $version"
echo "VERSION=$version" >> $GITHUB_ENV
- name: Check version
id: check_version
run: |
echo "Version in env: ${{ env.VERSION }}"
if [ -z "${{ env.VERSION }}" ]; then
echo "Error: VERSION is empty"
exit 1
fi
- name: Restore cached build artifacts
uses: actions/cache@v4
with:
path: dist
key: ${{ runner.os }}-3.11-x64-${{ hashFiles('**/pyproject.toml') }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} ${{ env.VERSION }} has been published to TestPyPI.'
continue-on-error: true