pipeline {
    agent any 
    stages {
        stage('Install Dependencies') {
            when {
                branch 'master'
            }
            steps {
                echo 'Installing Dependencies'
                sh '''cargo install --git https://github.com/typst/typst --locked typst-cli'''
            }
        }
        stage('Build') {
            when {
                branch 'master'
            }
            steps {
                echo 'Building'
                sh '''./render.sh'''
            }
        }
        // stage('Deploy') { 
        //     when {
        //         branch 'master'
        //     }
        //     steps {
        //         echo 'Deploying'
        //         sshagent(['jenkins-ssh-key']) {
        //             sh '''ssh airflow@clover "cd ~/airflow/dags && git fetch origin master && git reset --hard origin/master"''' 
        //         }
        //     }
        // }
    }

    post {
        always {
            archiveArtifacts artifacts: 'out/*.pdf', fingerprint: true
        }
    }
}