Skip to content

add commit

add commit #399

Workflow file for this run

name: Test and Tag
# Runs on every push to run the unit tests.
# Additionally, if on main, reads the current version from setup.py and then creates a new tag and release named
# for that version.
# If a tag already exists with that name, the Create Release step is skipped.
# Currently version must be manually updated in setup.py to enable this tagging job to run
on:
workflow_dispatch:
push:
paths-ignore:
- "**/README.md"
jobs:
run-unit-tests:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup python
id: setup_python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run tests
run: |
python -m venv .venv
source .venv/bin/activate && python -m pip install --upgrade pip && pip install -r requirements-dev.txt
pytest
create-release:
runs-on: ubuntu-latest
# needs: run-unit-tests
# if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup python
id: setup_python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Get package version
id: package_version
run: echo "::set-output name=app_version::"$(python setup.py --version)
- name: Bump release version
id: bump_version
uses: christian-draeger/[email protected]
with:
current-version: ${{ steps.package_version.outputs.app_version}}
version-fragment: 'bug'
- name: Update version in pyproject.toml
id: update_version
run: |
echo Updating version from ${{ steps.package_version.outputs.app_version}} to ${{ steps.bump_version.outputs.next-version }}
sed -i 's/version = "${{ steps.package_version.outputs.app_version}}"/version = "${{ steps.bump_version.outputs.next-version }}"/' pyproject.toml
cat pyproject.toml
git add pyproject.toml
git commit -m "Version bump in action"
git push origin master
# - name: Check if tag exists
# uses: mukunku/[email protected]
# id: check_tag
# with:
# tag: ${{ steps.bump_version.outputs.next-version }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - uses: ncipollo/release-action@v1
# name: Create Release
# id: create_release
# if: ${{ steps.check_tag.outputs.exists == 'false' }}
# with:
# commit: main
# tag: ${{ steps.bump_version.outputs.next-version }}
# token: ${{ secrets.GITHUB_TOKEN }}
# publish-release:
# runs-on: ubuntu-latest
# needs: create-release
# if: github.ref == 'refs/heads/main'
# steps:
# - uses: actions/checkout@v3
# - name: Setup python
# id: setup_python
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - name: Build for publish
# id: build_dist
# run: |
# python -m pip install --upgrade pip && pip install build
# python -m build
# echo workspace dir $GITHUB_WORKSPACE
# - name: Publish to PyPI
# id: publish-to-pypi
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}