Deploy #8
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: "Deploy" | |
# yamllint disable-line rule:truthy | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
MODULE_NAME: aiolyric | |
jobs: | |
deploy: | |
name: π Linux - Deploy Module | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: β€΅οΈ Check out code from GitHub | |
uses: actions/[email protected] | |
with: | |
ref: "master" | |
token: ${{ secrets.PUSH_TOKEN }} | |
- name: π Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.12" | |
architecture: "x64" | |
cache: "pip" | |
- name: π Install setuptools, wheel, twine, click, twisted, incremental | |
run: | | |
python -m pip install --upgrade setuptools wheel twine click twisted incremental | |
- name: π’ Get old version | |
id: get-version-old | |
run: | | |
python -m pip install . | |
# Read version from _version.py | |
result=$(python <<EOF | |
from ${{ env.MODULE_NAME }}._version import __version__ | |
print(__version__.public()) | |
EOF | |
) | |
echo "version=$result" >> $GITHUB_OUTPUT | |
- name: π’ Set correct vertion - Developement | |
if: ${{ github.event_name != 'release' }} | |
run: | | |
# If version does not contain dev, add it | |
if [[ ! "${{ steps.get-version-old.outputs.version }}" == *"dev"* ]]; then | |
python -m incremental.update ${{ env.MODULE_NAME }} --dev | |
fi | |
- name: π’ Set correct vertion - Release | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
# If version contains dev*, remove it | |
if [[ "${{ steps.get-version-old.outputs.version }}" == *"dev"* ]]; then | |
NEW_VERSION=$(echo "${{ steps.get-version-old.outputs.version }}" | sed 's/.dev.*//') | |
python -m incremental.update ${{ env.MODULE_NAME }} --newversion $NEW_VERSION | |
fi | |
- name: π’ Get current version | |
id: get-version-current | |
run: | | |
result=$(python <<EOF | |
from ${{ env.MODULE_NAME }}._version import __version__ | |
print(__version__.public()) | |
EOF | |
) | |
echo "version=$result" >> $GITHUB_OUTPUT | |
- name: β€΅οΈ Pull latest changes from GitHub | |
run: | | |
git pull --ff | |
- name: π Commit | |
uses: stefanzweifel/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
with: | |
commit_message: | | |
Bump ${{ env.MODULE_NAME }} version to ${{ steps.get-version-current.outputs.version }} | |
- name: π Install package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
- name: π’ Increment version - Developement | |
if: ${{ github.event_name != 'release' }} | |
run: | | |
python -m incremental.update ${{ env.MODULE_NAME }} --dev | |
- name: π’ Increment version - Release | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
python -m incremental.update ${{ env.MODULE_NAME }} --patch | |
python -m incremental.update ${{ env.MODULE_NAME }} --dev | |
- name: π’ Get new version | |
id: get-version-new | |
run: | | |
result=$(python <<EOF | |
from ${{ env.MODULE_NAME }}._version import __version__ | |
print(__version__.public()) | |
EOF | |
) | |
echo "version=$result" >> $GITHUB_OUTPUT | |
- name: β€΅οΈ Pull latest changes from GitHub | |
run: | | |
git pull --ff | |
- name: π Commit | |
uses: stefanzweifel/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
with: | |
commit_message: | | |
Bump ${{ env.MODULE_NAME }} version to ${{ steps.get-version-new.outputs.version }} |