-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (91 loc) · 3.96 KB
/
wheels_linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Release Linux
on:
push:
branches:
- dev
tags:
- 'v**'
pull_request:
branches:
- dev
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
python3 setup.py sdist bdist_wheel
# - 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?"