v12.0.0 #40
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Containerise and Upload to DAFNI | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
get_release_version: | |
name: Get Release Version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_release.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get release version | |
id: get_release | |
run: | | |
# Extract the version without the 'v' prefix using regex | |
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/') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
build_and_upload: | |
name: Docker Build | |
needs: get_release_version | |
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
env: | |
DAFNI_PARENT_ID: ${{ secrets.DAFNI_PARENT_ID }} | |
DAFNI_USERNAME: ${{ secrets.DAFNI_USERNAME }} | |
DAFNI_PASSWORD: ${{ secrets.DAFNI_PASSWORD }} | |
VERSION: ${{ needs.get_release_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install causal-testing-framework -e .[dev] | |
python -m pip install dafni-cli | |
- name: Check if unit tests are passing first | |
id: tests | |
uses: ./.github/workflows/ci-tests.yml | |
- name: Build the container | |
if: success() && steps.tests.outcome == 'success' | |
run: | | |
docker build -t ctf:${{ env.VERSION }} -f ./dafni/Dockerfile . | |
docker save ctf:${{ env.VERSION }} | gzip > ctf-dafni-${{ env.VERSION }}.tar.gz | |
- name: Log into DAFNI | |
run: | | |
dafni login | |
- name: Upload to DAFNI | |
run: | | |
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 | |
dafni logout |