-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (57 loc) · 1.88 KB
/
prepare-release.yaml
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
name: Prepare Release
on:
workflow_dispatch:
inputs:
bump:
description: 'The type of version bump to perform'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
# Major version is intentionally omitted, as it should be done manually
env:
MAIN_PYTHON_VERSION: 3.11
jobs:
create_prepare_branch:
runs-on: ubuntu-latest
environment: dev_read
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install required dependencies
run: |
python -m pip install --upgrade pip
pip install typer packaging
- name: Bump Patch Version
if: ${{ github.event.inputs.bump == 'patch' }}
run:
python dev.py --patch --verbose
- name: Bump Minor Version
if: ${{ github.event.inputs.bump == 'minor' }}
run:
python dev.py --minor --verbose
- id: version
name: Pick up the new version
# Read the version from the cognite/neat/_version.py file
run: echo "version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' cognite/neat/_version.py)" >> $GITHUB_ENV
- name: Switch to a new branch
run: |
git switch -c "prepare-${{ env.version }}"
- name: Commit and push changes to new branch
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add -A
git commit -m 'Prepare ${{ env.version }}'
git push -u origin "prepare-${{ env.version }}"