Update Version #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |