Repository navigation
66 lines (60 loc) · 1.57 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (60 loc) · 1.57 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: read
jobs:
build:
uses: ./.github/workflows/build.yml
check-version:
name: Check tag matches version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compare tag to pyproject version
run: |
tag="${GITHUB_REF_NAME#v}"
version=$(grep -E '^version = ' pyproject.toml | sed -E 's/^version = "([^"]+)"/\1/')
if [ "$tag" != "$version" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match pyproject version $version"
exit 1
fi
publish-pypi:
name: Publish to PyPI
needs: [build, check-version]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/raknet/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: "wheels-*"
path: dist
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
github-release:
name: GitHub release
needs: [publish-pypi]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
generate_release_notes: true
files: dist/*