diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 144994e..5db6895 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,9 +12,103 @@ permissions: pull-requests: write jobs: + checks: + name: Version check + runs-on: ubuntu-24.04 + steps: + - name: Checkout repository + id: repo + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: 3.14.0 + + - name: Get latest release from pip + id: latestreleased + run: | + PREVIOUS_VERSION=$(python -m pip index versions prepmd | grep "prepmd" | cut -d "(" -f2 | cut -d ")" -f1) + echo "pip_tag=$PREVIOUS_VERSION" >> "$GITHUB_OUTPUT" + echo $PREVIOUS_VERSION + + - name: version comparison + id: compare + run: | + pip3 install semver + output=$(pysemver compare ${{ steps.latestreleased.outputs.pip_tag }} ${{ github.event.inputs.version }}) + if [ $output -ge 0 ]; then exit 1; fi + + version: + name: prepare ${{ github.event.inputs.version }} + needs: checks + runs-on: ubuntu-24.04 + steps: + + - name: checkout + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + + - name: Change version in repo and CITATION.cff + run: | + # Update Python package version + sed -i "s/__version__ =.*/__version__ = \"${{ github.event.inputs.version }}\"/g" prepmd/__init__.py + + # Update CITATION.cff version and date-released + if [ -f CITATION.cff ]; then + sed -i -E "s/^(version:\s*).*/\1${{ github.event.inputs.version }}/" CITATION.cff + sed -i -E "s/^(date-released:\s*).*/\1'$(date -u +%F)'/" CITATION.cff + fi + + - name: send PR + id: pr_id + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 + with: + commit-message: Update version to ${{ github.event.inputs.version }} + branch: version-update + title: "Update to version ${{ github.event.inputs.version }}" + body: | + Update version + - Update the __init__.py with new release + - Update CITATION.cff version & date-released + - Auto-generated by [CI] + committer: version-updater + author: version-updater + base: main + signoff: false + draft: false + + - name: auto approve review + uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0 + with: + pull-request-number: ${{ steps.pr_id.outputs.pull-request-number }} + review-message: "Auto approved version bump PR" + github-token: ${{ secrets.AUTO_PR_MERGE }} + + - name: merge PR + run: gh pr merge --merge --delete-branch --auto "${{ steps.pr_id.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + tag: + name: tag release + needs: version + runs-on: ubuntu-24.04 + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + ref: main + + - name: tag v${{ github.event.inputs.version }} + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git tag ${{ github.event.inputs.version }} + git push origin tag ${{ github.event.inputs.version }} release: name: make github release + needs: tag runs-on: ubuntu-24.04 steps: @@ -27,7 +121,7 @@ jobs: conda: name: publish conda to anaconda.org - needs: release + needs: [tag, release] runs-on: ubuntu-24.04 steps: diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..75bd39e --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,30 @@ +# This CITATION.cff file was generated with cffinit. +# Visit https://bit.ly/cffinit to generate yours today! + +cff-version: 1.2.0 +title: prepmd +message: >- + If you use this software, please cite it using the + metadata from this file. +type: software +authors: + - given-names: Robert + family-names: Welch + email: robert.welch@stfc.ac.uk + affiliation: 'STFC, Scientific Computing' + - given-names: Harry + family-names: Swift + email: harry.swift@stfc.ac.uk + affiliation: 'STFC, Scientific Computing' + orcid: 'https://orcid.org/0009-0007-3323-753X' +repository-code: 'https://github.com/CCPBioSim/prepmd' +abstract: >- + A utility to automatically prepare structures from the PDB + for molecular dynamics simulation and perform + minimisations and simple MD simulations. +keywords: + - PDB + - MD simulations +license: AGPL-3.0 +version: 1.0.0 +date-released: '2026-04-14'