From 43a7803dcfb0f90e7a45d2c5245ab0bb97b61f43 Mon Sep 17 00:00:00 2001 From: daquintero Date: Fri, 12 Jan 2024 12:44:06 +0100 Subject: [PATCH] FEAT: Update relevant github actions --- .github/workflows/deploy.yml | 80 ++++++++++-------------------------- .github/workflows/linter.yml | 28 ++++++++----- .idea/workspace.xml | 23 ++--------- README.md | 2 +- 4 files changed, 43 insertions(+), 90 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c5c2073..f698533 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,73 +1,37 @@ -name: Deploy to pypi +name: "m2r3-release" + +permissions: + contents: write on: push: - branches: master tags: - 'v*.*.*' jobs: - untagged_deploy: + github-release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 + - uses: actions/checkout@master + - name: Release + uses: softprops/action-gh-release@v1 with: - python-version: 3.7 - - name: Install dependencies - run: pip install wheel - - name: Build package - run: python setup.py sdist bdist_wheel - - name: Publish package to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.test_pypi_token }} - repository_url: https://test.pypi.org/legacy/ - skip_existing: true - tagged_deploy: + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + pypi-release: runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 - with: - python-version: 3.7 + - uses: actions/setup-python@v2 - name: Install dependencies - run: pip install wheel - - name: Build package - run: python setup.py sdist bdist_wheel - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_token }} - skip_existing: true - - name: Update docs - uses: ammaraskar/sphinx-action@master - with: - docs-folder: "docs/" - - name: Create artifact - uses: actions/upload-artifact@v1 - with: - name: DocumentationHTML - path: docs/_build/html/ - - name: Commit documentation changes run: | - git clone https://github.com/crossnox/m2r2.git --branch gh-pages --single-branch gh-pages - cp -r docs/_build/html/* gh-pages/ - cd gh-pages - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add . - git commit -m "Update documentation ${{ github.ref }}" -a || true - # The above command will fail if no changes were present, so we ignore - # that. - - name: Push changes - uses: ad-m/github-push-action@master - with: - branch: gh-pages - directory: gh-pages - github_token: ${{ secrets.GH_TOKEN }} + python -m pip install --upgrade pip + python -m pip install setuptools wheel twine build + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python -m build + python -m twine upload --repository pypi dist/* \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index dedd682..59cfa9b 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,14 +6,20 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: Install nox - run: pip install nox - - name: Install dependencies - run: pip install -r requirements-dev.txt - - name: Run cop session - run: nox --sessions cop + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.x # Replace 'x' with your desired Python version + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python - + export PATH="$HOME/.local/bin:$PATH" + + - name: Install project dependencies (including dev) + run: poetry install + + - name: Run linters and formatters + run: poetry run pre-commit run --all-files diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 948307b..e4d75c3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,27 +5,10 @@ - - + + - - - - - - - - - - - - - - - - - diff --git a/README.md b/README.md index 745df15..bde0ad4 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ the original readme, changing only what's needed to work with `m2r2`. - IMPORTANT NOTE: it doesn't fully work, it just mostly works and I intend to keep adding any PRs that come my way. Not all the old functionality is there, but it's mostly there and builds. - Updated packaging to poetry, because it was a big pain to reproduce the original package development and this way it's easier to have a reproducible working environment. -- Works with the latest sphinx versions and mistune v2 +- Update python to the present, works with the latest sphinx versions and mistune v2. ## Why another converter?