Release #173
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
Release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get tag | |
id: tag | |
run: | | |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/} | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.9 | |
- name: Get full Python version | |
id: full-python-version | |
shell: bash | |
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") | |
- name: Install poetry | |
shell: bash | |
run: | | |
python -m pip install -U pip poetry | |
echo "$HOME/.poetry/bin:$PATH" >> $GITHUB_PATH | |
- name: Configure poetry | |
shell: bash | |
run: poetry config virtualenvs.in-project true | |
- name: Set up cache | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Ensure cache is healthy | |
if: steps.cache.outputs.cache-hit == 'true' | |
shell: bash | |
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | |
- name: Install dependencies | |
shell: bash | |
run: poetry install | |
- name: Build project for distribution | |
run: poetry run poetry build | |
- name: Publish to PyPI | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
run: poetry run poetry publish | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.tag }} | |
release_name: ${{ steps.tag.outputs.tag }} | |
draft: false | |
prerelease: false | |
- name: Upload Linux release file asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/aiohomekit-${{ steps.tag.outputs.tag }}.tar.gz | |
asset_name: aiohomekit-${{ steps.tag.outputs.tag }}.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Linux checksum file asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/aiohomekit-${{ steps.tag.outputs.tag }}-py3-none-any.whl | |
asset_name: aiohomekit-${{ steps.tag.outputs.tag }}-py3-none-any.whl | |
asset_content_type: application/x-wheel+zip |