Skip to content

Commit 903c7ba

Browse files
committed
fix: small changes to workflow
1 parent 6e4b514 commit 903c7ba

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,42 @@ on:
66
types: [published]
77

88
jobs:
9+
get_release_version:
10+
name: Get Release Version
11+
runs-on: ubuntu-latest
12+
outputs:
13+
version: ${{ steps.get_release.outputs.version }}
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
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"
923
1024
build_and_upload:
1125
name: Docker Build
26+
needs: get_release_version
1227
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
1328
runs-on: ubuntu-latest
1429
env:
1530
DAFNI_PARENT_ID: ${{ secrets.DAFNI_PARENT_ID }}
1631
DAFNI_USERNAME: ${{ secrets.DAFNI_USERNAME }}
1732
DAFNI_PASSWORD: ${{ secrets.DAFNI_PASSWORD }}
33+
VERSION: ${{ needs.get_release_version.outputs.version }}
1834

1935
steps:
2036
- uses: actions/checkout@v3
2137
- uses: actions/setup-python@v3
2238
with:
2339
python-version: 3.9
2440

25-
- name: Set CTF_VERSION and VERSION
26-
run: |
27-
TAG=${{ github.event.release.tag_name }}
28-
CTF_VERSION="$TAG"
29-
VERSION=$(echo "$TAG" | sed 's/v//; s/\.[0-9]*$//')
30-
echo "CTF_VERSION=${CTF_VERSION}" >> $GITHUB_ENV
31-
echo "VERSION=v${VERSION}" >> $GITHUB_ENV
32-
3341
- name: Build the container
3442
run: |
35-
docker build -t ctf:VERSION -f ./dafni/Dockerfile .
36-
docker save ctf:VERSION | gzip > 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
3745
3846
- name: Install DAFNI-CLI and log in
3947
run: |
@@ -42,5 +50,5 @@ jobs:
4250
4351
- name: Upload to DAFNI
4452
run: |
45-
dafni upload model ./dafni/model_definition.yaml ctf-${{ env.VERSION }}.tar.gz --version-message "Version ${{ env.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
4654
dafni logout

0 commit comments

Comments
 (0)