Repository navigation
111 lines (103 loc) · 2.97 KB
/
Copy pathbuild.yml
File metadata and controls
111 lines (103 loc) · 2.97 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
101
102
103
104
105
106
107
108
109
110
111
name: "DANCE"
on:
push:
branches:
- main
paths:
- 'disco/**'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: self-hosted
steps:
- name: Pull Repository
uses: actions/checkout@v4
# - name: Setup Python 3.12
# uses: actions/setup-python@v5
# with:
# python-version: "3.12"
- name: Setup Python 3.12
run: |
python3.12 -m venv .venv
source .venv/bin/activate
- name: Install Dependencies
run: |
source .venv/bin/activate
.venv/bin/python -m pip install --no-cache-dir --upgrade pip
.venv/bin/python -m pip install --no-cache-dir --upgrade setuptools
.venv/bin/python -m pip install --no-cache-dir --upgrade wheel
.venv/bin/python -m pip install --no-cache-dir --upgrade -r requirements.txt
.venv/bin/python -m pip install --no-cache-dir --upgrade build
- name: Build Wheel and Tarball Packages
run: |
source .venv/bin/activate
.venv/bin/python -m build
- name: Store distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Publish
needs:
- build
runs-on: self-hosted
environment:
name: pypi
url: https://pypi.org/p/betterdisco-py
permissions:
id-token: write
steps:
- name: Download Distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
github-release:
name: Sign and Release
needs:
- build
runs-on: self-hosted
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
# - name: Setup Python 3.12
# uses: actions/setup-python@v5
# with:
# python-version: "3.12"
- name: Setup Python 3.12
run: |
python3.12 -m venv .venv
source .venv/bin/activate
- name: Download Distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign
uses: sigstore/[email protected]
with:
inputs: |
./dist/*.tar.gz
./dist/*.whl
- name: Get Version from Commit Title
id: get_version
run: |
VERSION=$(git log --format=%B -n 1 HEAD | head -n 1)
echo "::set-output name=VERSION::$VERSION"
- name: Create Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create '${{ steps.get_version.outputs.VERSION }}' --repo '${{ github.repository }}' --notes ""
- name: Upload Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload '${{ steps.get_version.outputs.VERSION }}' dist/** --repo '${{ github.repository }}'