ci(deps): update ksxgithub/github-actions-deploy-aur action to v3 (#228) #542
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: 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@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 | |
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@32e74b369e077d605a823d29574313d894dd0f31 # v3.0.0 | |
with: | |
pkgname: python-images-upload-cli | |
pkgbuild: ./PKGBUILD | |
commit_username: DeadNews | |
commit_email: [email protected] | |
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.12" | |
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 |