PySCeS / pysces

The official PySCeS project source code repository.
https://pysces.github.io
Other
34 stars 10 forks source link

Automate releasing to BioSimulators #43

Closed jonrkarr closed 3 years ago

jonrkarr commented 3 years ago

PySCeS is available for simulation online through BioSimulators/RunBioSimulations. To keep the version of PySCeS in BioSimulators up to date, we recommend automating the release of new versions to BioSimulators.

This can be done using the GitHub API.

An easy way to do this is with the GitHub action below. This would automatically push PySCeS to BioSimulators when releases are published to GitHub. Note, this must be run a few minutes after PySCeS is released to PyPI. To use the action:

name: Update BioSimulators command-line interface and Docker image

on:
  release:
    types:
      - published

jobs:
  updateBioSimulatorsCliAndDockerImage:
    name: Trigger the building and release of the BioSimulators version of PySCeS
    runs-on: ubuntu-latest
    env:
      # Owner/repository-id for the GitHub repository for the downstream
      # command-line interface and Docker image.

      DOWNSTREAM_REPOSITORY: biosimulators/Biosimulators_PySCeS

      # Username/token to use the GitHub API to trigger an action on the GitHub
      # repository for the downstream command line interface and Docker image.
      # Tokens can be generated at https://github.com/settings/tokens and should
      # have the scope "repo".

      BIOSIMULATORS_GH_USERNAME: ${{ secrets.BIOSIMULATORS_GH_USERNAME }}
      BIOSIMULATORS_GH_TOKEN: ${{ secrets.BIOSIMULATORS_GH_TOKEN }}
    steps:
      - name: Trigger a GitHub action that will build and release the BioSimulators version of PySCeS
        run: |
          PACKAGE_VERSION="${GITHUB_REF/refs\/tags\//}"
          WORKFLOW_FILE=ci.yml

          curl -X POST \
               -u ${BIOSIMULATORS_GH_USERNAME}:${BIOSIMULATORS_GH_TOKEN} \
               -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${DOWNSTREAM_REPOSITORY}/actions/workflows/${WORKFLOW_FILE}/dispatches \
               -d "{\"ref\": \"dev\", \"inputs\": {\"simulatorVersion\": \"${PACKAGE_VERSION}\", \"simulatorVersionLatest\": \"true\"}}"
jonrkarr commented 3 years ago

I see you're using Travis. The HTTP request can be run from there.

jmrohwer commented 3 years ago

Implemented in #67 and https://github.com/PySCeS/pysces/commit/0a01137bc6e9e9b48bfe5c84a647258be2fbbf82