-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (116 loc) · 4.21 KB
/
update_version.yml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Update Version
on:
workflow_dispatch:
inputs:
bump:
description: 'The version bump to apply [possible values: major, minor, patch]'
required: true
type: choice
options:
- patch
- minor
- major
publish:
description: 'Publish the package to GitHub releases'
required: false
type: boolean
default: true
jobs:
update-version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install rye
uses: eifinger/setup-rye@v4
with:
enable-cache: true
version: '0.39.0'
# Do a version bump to the package
- name: Update version in pyproject.toml
run: |
rye version --bump ${{ github.event.inputs.bump }}
cd darts-acquisition && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-ensemble && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-export && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-pipeline && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-preprocessing && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-postprocessing && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-segmentation && rye version --bump ${{ github.event.inputs.bump }}
cd ../darts-superresolution && rye version --bump ${{ github.event.inputs.bump }}
# Get the new version with rye version and save it as an variable
- name: Get new version
id: get_version
run: echo "VERSION=$(rye version)" >> $GITHUB_OUTPUT
- name: Commit changes
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add pyproject.toml
git commit -m "${{ github.event.inputs.bump }} version bump to ${{ steps.get_version.outputs.VERSION }}"
git push
build-and-publish:
runs-on: ubuntu-latest
needs:
- update-version
permissions:
contents: write
id-token: write
if: github.event.inputs.publish
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install rye
uses: eifinger/setup-rye@v4
with:
enable-cache: true
version: '0.39.0'
- name: Build package
run: rye build --all
# TODO: Run tests
# - name: Publish to PyPI
# run: |
# rye publish --token ${{ secrets.PYPI_TOKEN }} --yes
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.update-version.outputs.VERSION }}
release_name: Release ${{ needs.update-version.outputs.VERSION }}
draft: false
prerelease: false
build-and-publish-docs:
runs-on: ubuntu-latest
needs:
- update-version
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get cache id
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material
- name: Install dependencies
run: |
pip install "mkdocs-material[imaging]>=9.5.38" "mkdocstrings[python]>=0.26.1" "mike>=2.1.3" "mkdocs-git-revision-date-localized-plugin>=1.2.9" "mkdocs-git-committers-plugin-2>=2.3.0"
- name: Publish documentation
run: mike deploy --push --update-aliases ${{ needs.update-version.outputs.VERSION }} latest