|
6 | 6 | types: [published]
|
7 | 7 |
|
8 | 8 | 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" |
9 | 23 |
|
10 | 24 | build_and_upload:
|
11 | 25 | name: Docker Build
|
| 26 | + needs: get_release_version |
12 | 27 | if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
|
13 | 28 | runs-on: ubuntu-latest
|
14 | 29 | env:
|
15 | 30 | DAFNI_PARENT_ID: ${{ secrets.DAFNI_PARENT_ID }}
|
16 | 31 | DAFNI_USERNAME: ${{ secrets.DAFNI_USERNAME }}
|
17 | 32 | DAFNI_PASSWORD: ${{ secrets.DAFNI_PASSWORD }}
|
| 33 | + VERSION: ${{ needs.get_release_version.outputs.version }} |
18 | 34 |
|
19 | 35 | steps:
|
20 | 36 | - uses: actions/checkout@v3
|
21 | 37 | - uses: actions/setup-python@v3
|
22 | 38 | with:
|
23 | 39 | python-version: 3.9
|
24 | 40 |
|
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 |
| -
|
33 | 41 | - name: Build the container
|
34 | 42 | 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 |
37 | 45 |
|
38 | 46 | - name: Install DAFNI-CLI and log in
|
39 | 47 | run: |
|
|
42 | 50 |
|
43 | 51 | - name: Upload to DAFNI
|
44 | 52 | 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 |
46 | 54 | dafni logout
|
0 commit comments