language: go

go:
  - master

addons:
  ssh_known_hosts: overflod.chary.us

before_install:
  - openssl aes-256-cbc -K $encrypted_da0730754d12_key -iv $encrypted_da0730754d12_iv -in travis_rsa.enc -out travis_rsa -d
  - chmod 600 travis_rsa
  - mv travis_rsa ~/.ssh/id_rsa

install:
  - ./scripts/install-hugo.sh

jobs:
  include:
    - stage: build
      if: tag IS NOT present
      script: hugo -b https://snoonet-beta.chary.us/
      after_success:
        - ./scripts/deploy.sh
    - stage: GitHub Release
      if: tag IS present
      script: hugo -b https://snoonet.org && tar -zcvf website-$TRAVIS_TAG.tar.gz public;
      deploy:
        provider: releases
        api_key: "$GITHUB_OAUTH_TOKEN"
        file: website-$TRAVIS_TAG.tar.gz
        skip_cleanup: true
        on:
          tags: true

language: go

go:
  - master

addons:
  ssh_known_hosts: overflod.chary.us

before_install:
  - openssl aes-256-cbc -K $encrypted_da0730754d12_key -iv $encrypted_da0730754d12_iv -in travis_rsa.enc -out travis_rsa -d
  - chmod 600 travis_rsa
  - mv travis_rsa ~/.ssh/id_rsa

install:
  - ./scripts/install-hugo.sh

jobs:
  include:
    # Build and deploy to staging (flotwig's host)
    - stage: build
      if: tag IS NOT present
      script: hugo -b https://snoonet-beta.chary.us/
      after_success:
        - ./scripts/deploy.sh

    # Build and deploy generated content to the gh-pages branch
    - stage: deploy
      if: tag IS present
      script:
        - hugo -b https://snoonet.org/
        - echo "$CNAME_URL" > public/CNAME
      deploy:
        provider: pages
        github-token: "$GITHUB_OAUTH_TOKEN"
        skip-cleanup: true
        email: "$GITHUB_EMAIL"
        name: "$GITHUB_USERNAME"
        verbose: true
        keep-history: true
        local-dir: public
        target-branch: gh-pages
        on:
          branch: master

Deploy generated content to gh-pages branch
Deploy generated content to gh-pages branch
