Debian Codegraph @

.github/workflows/release.yml

raw
1 name: Build and upload release
2 on:
3 workflow_dispatch:
4 schedule:
5 - cron: '0 0 * * 3'
6 push:
7 tags:
8 - '*'
9
10 jobs:
11 build_sdist:
12 name: Build sdist
13 runs-on: ubuntu-latest
14 steps:
15 - name: Checkout
16 uses: actions/checkout@v4
17 - name: Get history and tags for SCM versioning to work
18 run: |
19 git fetch --prune --unshallow
20 git fetch --depth=1 origin +refs/tags/*:refs/tags/*
21 - name: Setup Python
22 uses: actions/setup-python@v5
23 - name: Build sdist
24 run: |
25 pip install --upgrade pip
26 pip install wheel build
27 python -m build . -s
28 - name: Test sdist
29 run: |
30 pip install pytest
31 pip install dist/*.tar.gz
32 cd ..
33 python -m pytest cppy/tests
34 - name: Store artifacts
35 uses: actions/upload-artifact@v4
36 with:
37 name: cibw-sdist
38 path: dist/*
39
40 build_universal_wheel:
41 name: Build universal wheel
42 runs-on: ubuntu-latest
43 steps:
44 - name: Checkout
45 uses: actions/checkout@v4
46 - name: Get history and tags for SCM versioning to work
47 run: |
48 git fetch --prune --unshallow
49 git fetch --depth=1 origin +refs/tags/*:refs/tags/*
50 - name: Setup Python
51 uses: actions/setup-python@v5
52 - name: Build universal wheel
53 run: |
54 pip install --upgrade pip
55 pip install wheel build
56 python -m build .
57 - name: Test wheel
58 run: |
59 pip install pytest
60 pip install dist/*.whl
61 cd ..
62 python -m pytest cppy/tests
63 - name: Store artifacts
64 uses: actions/upload-artifact@v4
65 with:
66 name: cibw-wheel
67 path: dist/*.whl
68
69 publish:
70 if: github.event_name == 'push'
71 needs: [build_universal_wheel, build_sdist]
72 runs-on: ubuntu-latest
73 steps:
74 - uses: actions/[email protected]
75 with:
76 pattern: cibw-*
77 path: dist
78 merge-multiple: true
79
80 - uses: pypa/gh-action-pypi-publish@release/v1
81 with:
82 user: __token__
83 password: ${{ secrets.pypi_password }}
84 # To test:
85 # repository_url: https://test.pypi.org/legacy/
86
87 github-release:
88 name: >-
89 Sign the Python 🐍 distribution 📦 with Sigstore
90 and create a GitHub Release
91 runs-on: ubuntu-latest
92 needs:
93 - publish
94
95 permissions:
96 contents: write
97 id-token: write
98
99 steps:
100 - name: Download all the dists
101 uses: actions/[email protected]
102 with:
103 pattern: cibw-*
104 path: dist
105 merge-multiple: true
106 - name: Sign the dists with Sigstore
107 uses: sigstore/[email protected]
108 with:
109 password: ${{ secrets.pypi_password }}
110 inputs: >-
111 ./dist/*.tar.gz
112 ./dist/*.whl
113 - name: Create GitHub Release
114 env:
115 GITHUB_TOKEN: ${{ github.token }}
116 run: >-
117 gh release create
118 '${{ github.ref_name }}'
119 --repo '${{ github.repository }}'
120 --generate-notes
121 - name: Upload artifact signatures to GitHub Release
122 env:
123 GITHUB_TOKEN: ${{ github.token }}
124 run: >-
125 gh release upload
126 '${{ github.ref_name }}' dist/**
127 --repo '${{ github.repository }}'