CD #272
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: CD | |
# This action handles ImageIOs automatic releasing. It performs the following steps: | |
# | |
# - check for any new commits to master in fixed intervals (if none, exit) | |
# - check if they require a new semver version (if no, exit) | |
# - run through full unit-tests (if they fail, exit) | |
# - check if the docs build without warnings (if they fail, exit) | |
# - check if the wheel can be built (if it fails, exit) | |
# - bump ImageIO's version | |
# - update the changelog with the changes made (breaking, feature, fix, doc, | |
# ...) | |
# - commit, tag, and push the new version + changelog to master (this also | |
# pushes the new tag) | |
# - build the new imageIO version | |
# - release the new version to GitHub and PyPI | |
on: | |
schedule: | |
- cron: '42 1 * * 1' # weekly on Monday at 1:42am (UTC) | |
workflow_dispatch: | |
concurrency: | |
group: deployment | |
jobs: | |
initial_check: | |
name: Should release? | |
if: github.repository_owner == 'imageio' | |
runs-on: ubuntu-latest | |
outputs: | |
make_release: ${{ env.make_release }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install Dependencies | |
run: | | |
pip install python-semantic-release==7.34.6 | |
- name: Detect API changes | |
id: skippy | |
run: | | |
export PYTHONPATH=$PWD:$PYTHONPATH | |
if [[ $(semantic-release print-version 2>/dev/null) = "" ]]; then | |
echo "make_release=false" >> "$GITHUB_ENV" | |
echo "No changes to the API detected." | |
else | |
echo "make_release=true" >> "$GITHUB_ENV" | |
echo "Releasing v$(semantic-release print-version)" | |
fi | |
docs: | |
name: Build Docs | |
needs: initial_check | |
if: needs.initial_check.outputs.make_release == 'true' | |
uses: ./.github/workflows/build_docs.yml | |
cpython_tests: | |
needs: initial_check | |
if: needs.initial_check.outputs.make_release == 'true' | |
name: CPython Test Suite | |
uses: ./.github/workflows/cpython_tests.yml | |
pypy_tests: | |
name: PyPy Test Suite | |
needs: initial_check | |
if: needs.initial_check.outputs.make_release == 'true' | |
uses: ./.github/workflows/pypy_tests.yml | |
build_test: | |
name: Wheel Building Test | |
needs: initial_check | |
if: needs.initial_check.outputs.make_release == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies for tests | |
shell: bash | |
run: | | |
pip install .[build] | |
- name: Build the wheel | |
run: python setup.py sdist bdist_wheel | |
release: | |
name: Release new Version | |
needs: [cpython_tests, pypy_tests, build_test, docs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Python Semantic Release | |
uses: python-semantic-release/python-semantic-release@v7.34.6 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_API_TOKEN }} |