@@ -2,47 +2,46 @@ name: Containerise and Upload to DAFNI
2
2
3
3
on :
4
4
workflow_dispatch :
5
- workflow_run :
6
- workflows : ["publish-to-pypi"]
7
- branches : main
8
- types : [completed]
5
+ release :
6
+ types : [published]
9
7
10
8
jobs :
11
-
12
- check_publish_to_pypi :
13
- name : Check Publish to PyPI
9
+ get_release_version :
10
+ name : Get Release Version
14
11
runs-on : ubuntu-latest
15
-
12
+ outputs :
13
+ version : ${{ steps.get_release.outputs.version }}
16
14
steps :
17
- - name : Check if Publish to PyPI succeeded
18
- id : check_publish
19
- run : |
20
- if [ "${{ github.event.workflow_run.conclusion }}" = "success" ]; then
21
- echo "The Causal Testing Framework has been published to PyPI"
22
- else
23
- echo "The Causal Testing Framework has not been published to PyPI"
24
- fi
15
+ - name : Checkout code
16
+ uses : actions/checkout@v3
25
17
18
+ - name : Get release version
19
+ id : get_release
20
+ run : |
21
+ export VERSION=$(curl -sSL https://api.github.com/repos/CITCOM-project/CausalTestingFramework/releases/latest | jq -r '.tag_name' | head -c 2)
22
+ echo "::set-output name=version::$VERSION"
26
23
27
24
build_and_upload :
28
25
name : Docker Build
29
- if : ${{ github.event_name == 'workflow_dispatch' || needs.check_publish_to_pypi.outputs.check_publish == 'success' }}
26
+ needs : get_release_version
27
+ if : ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
30
28
runs-on : ubuntu-latest
31
29
env :
32
30
DAFNI_PARENT_ID : ${{ secrets.DAFNI_PARENT_ID }}
33
31
DAFNI_USERNAME : ${{ secrets.DAFNI_USERNAME }}
34
32
DAFNI_PASSWORD : ${{ secrets.DAFNI_PASSWORD }}
35
- CTF_VERSION : " ${{ github.event.release.tag_name | replace('.', '') }} "
33
+ VERSION : ${{ needs.get_release_version.outputs.version }}
36
34
37
35
steps :
38
36
- uses : actions/checkout@v3
39
37
- uses : actions/setup-python@v3
40
38
with :
41
39
python-version : 3.9
40
+
42
41
- name : Build the container
43
42
run : |
44
- docker build -t ctf:${CTF_VERSION } -f ./dafni/Dockerfile .
45
- docker save ctf:${CTF_VERSION} | gzip > ctf${CTF_VERSION }.tar.gz
43
+ docker build -t ctf:${{ env.VERSION } } -f ./dafni/Dockerfile .
44
+ docker save ctf:${{ env.VERSION }} | gzip > ctf-dafni-${{ env.VERSION } }.tar.gz
46
45
47
46
- name : Install DAFNI-CLI and log in
48
47
run : |
51
50
52
51
- name : Upload to DAFNI
53
52
run : |
54
- dafni upload model ./dafni/model_definition.yaml ctf${CTF_VERSION} .tar.gz --version-message "Version ${CTF_VERSION} . Uploaded via Github." --parent-id ${DAFNI_PARENT_ID} -y
53
+ dafni upload model ./dafni/model_definition.yaml ctf-dafni-${{ env.VERSION }} .tar.gz --version-message "Causal Testing Framework ${{ env.VERSION }} . Uploaded via Github Actions ." --parent-id ${{ env. DAFNI_PARENT_ID } } -y
55
54
dafni logout
0 commit comments