Skip to content

Automate release to BioSimulators #34

@jonrkarr

Description

@jonrkarr

CBMPy is available for simulation online through BioSimulators/RunBioSimulations. To keep the version of CBMPy 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 CBMPy 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:

  • Save the YAML below to .github/workflows/release-biosimulators.yml
  • Add two repository "secrets" at https://github.com/SystemsBioinformatics/cbmpy/settings/secrets/actions. Secrets are the mechanism that GitHub provides to use passwords without storing them inside repositories
    • Click the "New repository secret" button
    • Add two secrets:
      • BIOSIMULATORS_GH_USERNAME: the name of the GitHub user who pushes CBMPy to BioSimulators (e.g., bgoli). bgoli already has permissions for this.
      • BIOSIMULATORS_GH_TOKEN: token for BIOSIMULATORS_GH_USERNAME
  • A token for BIOSIMULATORS_GH_USERNAME can be created a https://github.com/settings/tokens
    • Select scope repo
  • It may also be necessary to enable actions here
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 CBMPy
    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_CBMPy

      # 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 CBMPy
        run: |
          PACKAGE_VERSION="${GITHUB_REF/refs\/tags\/v/}"
          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\"}}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions