Skip to content

Commit

Permalink
DOC, CI: citation.cff, changelog, modernized publication workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jotelha committed Jul 9, 2024
1 parent 8315ad6 commit a1eed8f
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 9 deletions.
107 changes: 98 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ on:
- '*'

jobs:
build:

build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
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: |
Expand All @@ -33,19 +34,107 @@ jobs:
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-retrieve-plugin-mongo

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-retrieve-plugin-mongo # Replace <package-name> 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/[email protected]
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 }}'
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ CHANGELOG
This project uses `semantic versioning <http://semver.org/>`_.
This change log uses principles from `keep a changelog <http://keepachangelog.com/>`_.

[0.4.2]
-------

Added
^^^^^

- Automated github release
- Zenodo integration
- Trusted publishing on PyPI


[0.4.1]
-------

Expand Down
9 changes: 9 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cff-version: 1.2.0
authors:
- family-names: Hörmann
given-names: Johannes L.
orcid: 0000-0001-5867-695X
- family-names: Olsson
given-names: Tjelvar S. G.
orcid: 0000-0001-8791-4531
title: dserver-retrieve-plugin-mongo

0 comments on commit a1eed8f

Please sign in to comment.