Skip to content

ci(deps): update pre-commit hooks #494

ci(deps): update pre-commit hooks

ci(deps): update pre-commit hooks #494

Workflow file for this run

name: Main
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
permissions:
contents: read
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
cache: poetry
- name: Install deps
run: poetry install
- name: Lint code
run: poetry run poe lint
tests:
name: Tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install deps
run: poetry install
- name: Run tests
run: poetry run poe test
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5
pypi-deploy:
name: Release to PyPI
if: github.ref_type == 'tag'
needs: [lint, tests]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry
pipx inject poetry poetry-dynamic-versioning[plugin]
- uses: actions/setup-python@v5
- name: Build package
run: poetry build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
aur-deploy:
name: Release to AUR
if: true && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta')
needs: [pypi-deploy]
environment:
name: aur
url: https://aur.archlinux.org/packages/python-images-upload-cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Wait for PyPI update
run: sleep 10
- name: Update version in PKGBUILD
run: |
sed "s|^pkgver=.*$|pkgver=\"${GITHUB_REF_NAME#v}\"|" -i PKGBUILD
- name: Deploy PKGBUILD to the Arch User Repository
uses: ksxgithub/github-actions-deploy-aur@f253a99125c1ca6bf2451d5a126fe04214d884bd # v2.7.1
with:
pkgname: python-images-upload-cli
pkgbuild: ./PKGBUILD
commit_username: DeadNews
commit_email: deadnewsgit@gmail.com
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Upstream release ${{ github.ref_name }}
updpkgsums: true
github-deploy:
name: Release to GitHub
if: github.ref_type == 'tag'
needs: [lint, tests]
environment: github-releases
permissions:
contents: write
env:
CHANGELOG: https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md
PRERELEASE: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create GitHub Release
run: |
gh release create ${{ github.ref_name }} \
--title ${{ github.ref_name }} \
--notes="See [the CHANGELOG](${{ env.CHANGELOG }}) for more details." \
--draft=${{ env.PRERELEASE }} \
--prerelease=${{ env.PRERELEASE }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-win:
name: Windows Build
if: github.ref_type == 'tag'
needs: [github-deploy]
environment: github-releases
permissions:
contents: write
env:
ASSET: ${{ github.event.repository.name }}_${{ github.ref_name }}_windows_amd64.zip
BINARY: ${{ github.event.repository.name }}.exe
NUITKA_CACHE_DIR: /cache/nuitka
PYTHON_VERSION: "3.11"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install deps
run: poetry install
- name: Cache nuitka
uses: actions/cache@v4
with:
key: ${{ runner.os }}-nuitka
path: ${{ env.NUITKA_CACHE_DIR }}
- name: Build binaries
run: poetry run poe nuitka --output-file ${{ env.BINARY }}
- name: Archive binaries
run: poetry run python -m zipfile --create ${{ env.ASSET }} dist/${{ env.BINARY }}
- name: Upload binaries to Release
run: gh release upload ${{ github.ref_name }} ${{ env.ASSET }}
env:
GITHUB_TOKEN: ${{ github.token }}
docs-build:
name: Build docs
if: github.ref_type == 'tag'
needs: [lint, tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
cache: poetry
- name: Install deps
run: poetry install
- name: Build docs
run: poetry run mkdocs build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
docs-deploy:
name: Deploy docs
if: true && !contains(github.ref, 'alpha')
needs: [docs-build]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
id-token: write
pages: write
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4