-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (83 loc) · 2.56 KB
/
release.yml
File metadata and controls
100 lines (83 loc) · 2.56 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# .github/workflows/release.yml
# Build distributions on GitHub Release and publish to PyPI (Trusted Publishers)
# Automatically patches version from the release tag before building.
name: Build & Publish to PyPI
on:
release:
types: [published]
permissions:
contents: write # upload assets to GitHub release
id-token: write # required for PyPI Trusted Publishing (OIDC)
jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from release tag
id: version
run: |
RAW="${GITHUB_REF#refs/tags/}"
SEMVER="${RAW#v}"
echo "VERSION=$SEMVER" >> "$GITHUB_ENV"
echo "📦 Building version: $SEMVER"
- name: Patch pyproject.toml version
run: |
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
echo "✅ pyproject.toml → $VERSION"
grep '^version' pyproject.toml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
run: |
cd frontend
npm ci
- name: Build frontend
run: |
cd frontend
npm run build
- name: Install build backend
run: |
python -m pip install --upgrade pip build
- name: Build wheel and sdist
run: |
# Just in case, ensure clean dist/ in the CI workspace
rm -rf dist build
python -m build
- name: Upload artefacts to the GitHub release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.whl
dist/*.tar.gz
- name: Persist artefacts for publish job
uses: actions/upload-artifact@v4
with:
name: python-dists
path: dist/
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build
environment:
name: pypi
url: https://pypi.org/project/gitcopilot/
steps:
- name: Download artefacts
uses: actions/download-artifact@v4
with:
name: python-dists
path: dist/
- name: Publish via Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1
# no extra config needed; it will upload dist/* using OIDC