From e6f115c5b50a99f2a356ac9436ecf6cbe6deb97f Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Tue, 9 Jul 2024 22:56:12 +0200 Subject: [PATCH] DOC, CI: added CITATION.cff, updated changelog, modernized publication workflow --- .github/workflows/publish.yml | 109 ++++++++++++++++++++++++++++++---- CHANGELOG.rst | 5 ++ CITATION.cff | 11 ++++ 3 files changed, 115 insertions(+), 10 deletions(-) create mode 100644 CITATION.cff diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 43571e2..501e2f3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,8 +8,9 @@ on: - '*' jobs: - test: + build: + name: Build runs-on: ubuntu-latest steps: @@ -17,35 +18,123 @@ jobs: with: fetch-depth: 0 - - name: Set up Python 3.8 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install requirements run: | pip install --upgrade build pip install --upgrade setuptools wheel setuptools-scm[toml] importlib-metadata - pip install git+https://github.com/livMatS/dservercore.git@main + pip install git+https://github.com/jic-dtool/dservercore.git@main pip list - name: Package distribution run: | python -m build - - name: Publish distribution to Test PyPI + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + + publish-to-testpypi: + name: Publish to TestPyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/dserver-notification-plugin + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + - name: Publish distribution 📦 to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.test_pypi_password }} repository-url: https://test.pypi.org/legacy/ verbose: true skip-existing: true + + publish-to-pypi: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/dserver-notification-plugin # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.pypi_password }} verbose: true + + + github-release: + name: >- + Make github release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + - name: Sign with Sigstore + uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' \ No newline at end of file diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6e3d8ad..e59ff33 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Change log for dserver-notification-plugin ========================================== +0.4.1 (9Jul24) +--------------- + +* Automated github release creation + 0.4.0 (13Jun24) --------------- diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..a599f13 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,11 @@ +cff-version: 1.2.0 +authors: +- family-names: Hörmann + given-names: Johannes Laurin + orcid: 0000-0001-5867-695X +- family-names: Pastewka + given-names: Lars + orcid: 0000-0001-8351-7336 +title: dserver-notification-plugin +version: 0.4.1 +date-released: 2024-07-09