Skip to content

Commit 74c6f2f

Browse files
committed
update: publish-to-dafni.yaml
1 parent a26c051 commit 74c6f2f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/publish-to-dafni.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ jobs:
1818
- name: Get release version
1919
id: get_release
2020
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"
21+
# Extract the version without the 'v' prefix using regex
22+
export VERSION=$(curl -sSL https://api.github.com/repos/CITCOM-project/CausalTestingFramework/releases/latest | jq -r '.tag_name' | sed -E 's/^v?([0-9]+(\.[0-9]+)?).*/\1/')
23+
echo "version=$VERSION" >> $GITHUB_OUTPUT
2324
2425
build_and_upload:
2526
name: Docker Build
@@ -44,22 +45,22 @@ jobs:
4445
python -m pip install causal-testing-framework -e .[dev]
4546
python -m pip install dafni-cli
4647
47-
- name: Run tests before uploading
48+
- name: Check if unit tests are passing first
4849
id: tests
49-
run: |
50-
python -m pytest ./dafni/tests
50+
uses: ./.github/workflows/ci-tests.yml
5151

5252
- name: Build the container
53-
if: steps.tests.outcome == 'success'
53+
if: success() && steps.tests.outcome == 'success'
5454
run: |
5555
docker build -t ctf:${{ env.VERSION }} -f ./dafni/Dockerfile .
5656
docker save ctf:${{ env.VERSION }} | gzip > ctf-dafni-${{ env.VERSION }}.tar.gz
5757
58+
5859
- name: Log into DAFNI
5960
run: |
6061
dafni login
6162
6263
- name: Upload to DAFNI
6364
run: |
64-
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
65-
dafni logout
65+
dafni upload model ./dafni/model_definition.yaml ctf-dafni-${{ env.VERSION }}.tar.gz --version-message "Causal Testing Framework v${{ env.VERSION }}. Uploaded via Github Actions." --parent-id ${{ env.DAFNI_PARENT_ID }} -y
66+
dafni logout

0 commit comments

Comments
 (0)