#!/usr/bin/env groovy

properties(
    [
        pipelineTriggers([[$class: "tv.justin.jenkins.twitchgithub.GitHubPushTrigger"]]),
    ]
)
pipeline {
    agent any
    options {
        disableConcurrentBuilds()
        timeout(time: 1, unit: 'HOURS')
        ansiColor('xterm')
        timestamps()
    }
    stages {
        stage('Build and publish gh-pages') {
            when {
                branch 'master'
            }
            steps {
                sshagent(credentials: ['git-aws-read-key']) {
                    sh 'git fetch --no-tags git@git.xarth.tv:eventbus/docs.git +refs/heads/gh-pages:refs/remotes/origin/gh-pages'
                    sh 'make publish'
                }
            }
        }
    }
}
