-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 1.66 KB
/
Copy pathrelease.yml
File metadata and controls
67 lines (54 loc) · 1.66 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
id-token: write
jobs:
build-and-release:
name: Validate, build, and publish release artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install build tooling
run: python -m pip install --upgrade pip build
- name: Install project with extras
run: pip install '.[dev,test]'
- name: Verify tag matches project version
env:
TAG_REF: ${{ github.ref }}
run: |
python - <<'PY'
import os
import tomllib
from pathlib import Path
tag = os.environ["TAG_REF"].split("/")[-1]
project_version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
expected_tag = f"v{project_version}"
if tag != expected_tag:
raise SystemExit(f"Tag {tag} does not match project version {expected_tag}")
PY
- name: Run tests
run: pytest -q
- name: Build distribution artifacts
run: python -m build
- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: neuroca-dist-${{ github.ref_name }}
path: dist
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-rc') }}