permissions #31
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: Seeqret CI/CD | |
on: | |
push | |
permissions: read-all | |
env: | |
HOME_REPO: thebjorn/seeqret | |
jobs: | |
lint: | |
name: Run linting | |
runs-on: ubuntu-latest | |
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 seeqret/ | |
test: | |
name: Run tests and upload coverage reports to Codecov | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.12', '3.13'] | |
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@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false | |
build-docs: | |
name: Build docs and deploy to gh-pages | |
runs-on: ubuntu-latest | |
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 -r requirements.txt | |
pip install -e . | |
- name: Build docs | |
run: | | |
git pull --ff | |
mkdocs build | |
- name: Deploy docs | |
run: | | |
mkdocs gh-deploy | |
publish-docs: | |
name: Publish docs to gh-pages | |
needs: build-docs | |
permissions: write-all | |
environment: | |
name: github-pages | |
url: ${{ steps.deploy-pages.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: . | |
- name: Deploy it to Github pages | |
uses: actions/deploy-pages@v4 | |
publish: | |
name: Publish package to PyPI | |
runs-on: ubuntu-latest | |
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: 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/* | |
- 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/*" | |
owner: thebjorn | |
repo: pydeps | |
token: ${{ secrets.GITHUB_TOKEN }} |