-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.74 KB
/
Copy pathrelease.yml
File metadata and controls
61 lines (52 loc) · 1.74 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read package version
id: meta
run: |
VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
echo "archive=reloop-python-$VERSION-source.zip" >> "$GITHUB_OUTPUT"
- name: Verify tag matches pyproject.toml
if: github.ref_type == 'tag'
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION="${{ steps.meta.outputs.version }}"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Tag v$TAG_VERSION does not match pyproject.toml version $PKG_VERSION"
exit 1
fi
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install, test, and build
run: |
python -m pip install --upgrade pip hatch
python -m unittest discover -s tests -v
hatch build
- name: Create source archive
run: |
zip -r "${{ steps.meta.outputs.archive }}" . \
-x '*.git*' '.venv/*' '**/__pycache__/*' '.github/*'
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: Reloop Python SDK ${{ steps.meta.outputs.tag }}
generate_release_notes: true
files: |
${{ steps.meta.outputs.archive }}
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}