-
Notifications
You must be signed in to change notification settings - Fork 5
56 lines (49 loc) · 1.79 KB
/
Copy pathrelease.yml
File metadata and controls
56 lines (49 loc) · 1.79 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
name: Release
# Controls when the action will run.
on:
workflow_call:
jobs:
# make a new version first, release or prerelease
release:
# Only run this job if new work is pushed to "main"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
# depth=0 is needed for semantic-release
- name: Checking out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Setup git user
shell: sh
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setting up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
ci/requirements.txt
- name: Install dependencies
shell: sh
run: |
[ -d "/c/miniconda" ] && /c/miniconda/condabin/activate.bat
python -m pip install --upgrade pip
python -m pip install --progress-bar=off -r ci/requirements.txt
- name: Determine a version number
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: sh
run: |
set -x
NEWVER=$(semantic-release version --print)
# version number updates with regexp which is not supported by
# semantic_release.version_variables in pyproject.toml
sed -i -e "s/v\([0-9]\+\.\)\{2\}\([0-9]\+\)/v$NEWVER/g" README.md
sed -i -e "/version:/s/\([0-9]\+\.\)\{2\}[0-9]\+/$NEWVER/" .copier-answers.yml
git add README.md .copier-answers.yml
# creates a release only if there are relevant changes/commits starting with 'fix/feat()'
semantic-release version