-
Notifications
You must be signed in to change notification settings - Fork 5
106 lines (88 loc) · 2.68 KB
/
feature-fix.yml
File metadata and controls
106 lines (88 loc) · 2.68 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
name: Feature/Fix Branch
on:
workflow_dispatch:
# This workflow became useless after the introduction of the `commit_version_tag.yml` workflow.
# Keeping for now until new version has been tested.
# push:
# branches:
# - 'feat/**'
# - 'fix/**'
# pull_request:
# branches:
# - 'feat/**'
# - 'fix/**'
env:
PYTHON_VERSION: '3.12'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Update version for branch
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
python scripts/version_manager.py --update-for-branch "$BRANCH_NAME"
- name: Get version info
id: version
run: |
VERSION=$(python scripts/version_manager.py --get)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Prepare version for build
run: |
python scripts/prepare_version.py
- name: Build package
run: |
python -m build
- name: Test package installation
run: |
pip install dist/*.whl
- name: Display version info
run: |
echo "Built version: ${{ steps.version.outputs.version }}"
echo "Branch: ${GITHUB_REF#refs/heads/}"
version-increment:
if: github.event_name == 'push'
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Increment build number
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
python scripts/version_manager.py --increment build --branch "$BRANCH_NAME"
- name: Get updated version
id: version
run: |
VERSION=$(python scripts/version_manager.py --get)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Updated version: $VERSION"
- name: Commit updated VERSION file
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add VERSION
git diff --staged --quiet || git commit -m "Increment build number to ${{ steps.version.outputs.version }}"
git push
- name: Create lightweight tag
run: |
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}