Skip to content

tagged-upversion

tagged-upversion #165

Workflow file for this run

name: Seeqret CI/CD
on: [ push, pull_request, workflow_dispatch ]
env:
HOME_REPO: thebjorn/seeqret
jobs:
lint:
name: Run linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run linting
run: |
flake8 --max-line-length 100 seeqret/
test:
name: Run tests and upload coverage reports to Codecov
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.12', '3.13']
# ubuntu-24.04 will soon be ubuntu-latest 2024-12-25
os: [ubuntu-24.04, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- name: Run tests
run: |
pytest -vv --cov=seeqret --cov-report=xml tests/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
build-docs:
name: Build docs and deploy to gh-pages
# github runs both a push and a tag action and they somehow interefere with gh-pages, so skip tags?
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-24.04
steps:
- name: Checkout main
uses: actions/checkout@v4
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
# uses: mhausenblas/mkdocs-deploy-gh-pages@nomaterial
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CUSTOM_DOMAIN: optionaldomain.com
# CONFIG_FILE: folder/mkdocs.yml
# EXTRA_PACKAGES: build-base
# GITHUB_DOMAIN: github.myenterprise.com
# REQUIREMENTS: folder/requirements.txt
publish:
name: Publish package to PyPI
needs:
- test
runs-on: ubuntu-24.04
permissions:
contents: write
deployments: write
actions: write
packages: write
attestations: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install -U build twine
python -m build
- name: Upload packages as artifact
uses: actions/upload-artifact@v4
with:
name: Packages
path: dist/
- name: Create Github release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == env.HOME_REPO
with:
artifacts: "dist/*"
- name: Deploy to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == env.HOME_REPO
shell: bash
run: |
twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/*