update biosimulators.json to new version #432
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Linux | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v**' | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
wheel: | |
runs-on: ubuntu-latest | |
env: | |
SMOLDYN_PYPI_TOKEN: ${{ secrets.SMOLDYN_PYPI_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Building wheel in ManuLinux container | |
run: | | |
ls -ltR | |
export PYPI_PASSWORD=$SMOLDYN_PYPI_TOKEN | |
cd scripts && make wheels | |
# BioSimulators | |
- name: Build BioSimulators Docker image | |
env: | |
TAG: ${{ github.ref }} | |
run: | | |
cp ~/wheelhouse/smoldyn-*-cp39-*.whl scripts/ | |
cd scripts | |
if [[ "${TAG}" =~ ^refs/tags/ ]]; then | |
VERSION="${TAG/refs\/tags\/v/}" | |
else | |
WHEEL_PATH=$(ls smoldyn*.whl) | |
VERSION=$(echo $WHEEL_PATH | cut -d - -f 2- | cut -d . -f 1-2) | |
fi | |
REVISION=$(git rev-parse HEAD) | |
CREATED=$(date --rfc-3339=seconds | sed 's/ /T/') | |
docker build \ | |
--file Dockerfile-BioSimulators \ | |
--tag ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:${VERSION} \ | |
--tag ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:latest \ | |
--build-arg VERSION=${VERSION} \ | |
--label org.opencontainers.image.revision=${REVISION} \ | |
--label org.opencontainers.image.created=${CREATED} \ | |
. | |
- name: Push BioSimulators Docker image | |
env: | |
TAG: ${{ github.ref }} | |
run: | | |
cd scripts | |
if [[ "${TAG}" =~ ^refs/tags/ ]]; then | |
VERSION="${TAG/refs\/tags\/v/}" | |
else | |
WHEEL_PATH=$(ls smoldyn*.whl) | |
VERSION=$(echo $WHEEL_PATH | cut -d - -f 2- | cut -d . -f 1-2) | |
fi | |
( | |
docker login ghcr.io \ | |
--username ${{ secrets.BIOSIMULATORS_GH_USERNAME }} \ | |
--password ${{ secrets.BIOSIMULATORS_GH_TOKEN }} | |
docker push ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:${VERSION} | |
docker push ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:latest | |
) || echo "The BioSimulators Docker image could not be pushed. Check that the BIOSIMULATORS_GH_USERNAME and BIOSIMULATORS_GH_TOKEN secrets are defined." | |
- name: Submit Smoldyn to BioSimulators | |
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
env: | |
TAG: ${{ github.ref }} | |
run: | | |
cd scripts | |
if [[ "${TAG}" =~ ^refs/tags/ ]]; then | |
VERSION="${TAG/refs\/tags\/v/}" | |
else | |
WHEEL_PATH=$(ls smoldyn*.whl) | |
VERSION=$(echo $WHEEL_PATH | cut -d - -f 2- | cut -d . -f 1-2) | |
fi | |
REVISION=$(git rev-parse HEAD) | |
IMAGE_DIGEST=$(docker image inspect ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:${VERSION} | jq -r '.[0].RepoDigests[0]' | cut -d "@" -f 2-) | |
( | |
curl \ | |
-X POST \ | |
-u ${{ secrets.BIOSIMULATORS_GH_USERNAME }}:${{ secrets.BIOSIMULATORS_GH_TOKEN }} \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/biosimulators/Biosimulators/issues \ | |
-d "{\"labels\": [\"Validate/submit simulator\"], \"title\": \"Submit Smoldyn ${VERSION}\", \"body\": \"---\nid: smoldyn\nversion: \\\"${VERSION}\\\"\nspecificationsUrl: https://raw.githubusercontent.com/ssandrews/Smoldyn/${REVISION}/biosimulators.json\nspecificationsPatch:\n version: \\\"${VERSION}\\\"\n image:\n url: ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:${VERSION}\n digest: \\\"${IMAGE_DIGEST}\\\"\nvalidateImage: true\ncommitSimulator: true\n\n---\"}" | |
) || echo "Failed to create issue. Probably secrets are not available?" |