1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+
18+ name : ' Update Package Version'
19+ description : ' Updates pyproject.toml version with timestamp'
20+ runs :
21+ using : " composite"
22+ steps :
23+ - name : Setup Python
24+ uses : actions/setup-python@v5
25+ with :
26+ python-version : ' 3.12'
27+
28+ - name : Install toml
29+ run : pip install toml
30+ shell : bash
31+
32+ - name : Get and update version
33+ shell : bash
34+ run : |
35+ CURRENT_VERSION=$(python -c "import toml; print(toml.load('bindings/python/pyproject.toml')['project']['version'])")
36+ TIMESTAMP=$(date +%Y%m%d%H%M%S)
37+ NEW_VERSION="${CURRENT_VERSION}.dev${TIMESTAMP}"
38+ NEW_VERSION=$NEW_VERSION python -c "
39+ import toml
40+ import os
41+ config = toml.load('bindings/python/pyproject.toml')
42+ config['project']['version'] = os.environ['NEW_VERSION']
43+ with open('bindings/python/pyproject.toml', 'w') as f:
44+ toml.dump(config, f)
45+ print(f'Updated version to: {config[\"project\"][\"version\"]}')
46+ "
0 commit comments