-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (67 loc) · 2.2 KB
/
release.yaml
File metadata and controls
73 lines (67 loc) · 2.2 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
---
name: release
on:
push:
branches:
- main
env:
PYTHON_VERSION: '3.10'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install required dependencies
run: |
uv sync --all-extras
- name: Linting and static code checks
run: uv run pre-commit run --all-files
release:
runs-on: ubuntu-latest
environment: CD
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install required dependencies
run: |
uv sync --all-extras
- name: Dump last commit message to file
run: git log -1 --pretty=%B > last_git_message.txt
- name: Dump last tag to file
run: git describe --tags --abbrev=0 > last_version.txt
- name: Bump Version
run: uv run python dev.py bump --verbose
- id: version
name: Read the new version
# Read the version from the cognite/pygen/_version.py file
run: echo "version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' cognite/pygen/_version.py)" >> $GITHUB_ENV
- name: Create CHANGELOG entry
if: env.version != '0.0.0'
run: uv run python dev.py changelog
- name: Build package
if: env.version != '0.0.0'
run: uv build
- name: Release to PyPI
if: env.version != '0.0.0'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: uv run twine upload --skip-existing --verbose dist/*
- name: Add entry to CHANGELOG
if: env.version != '0.0.0'
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
draft: false
tag: ${{ env.version }}
bodyFile: last_changelog_entry.md