image: ubuntu:vivid

test-stable:
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo
    - grep -v "maud_macros" Cargo.toml > Cargo.toml.new
    - mv Cargo.toml.new Cargo.toml
    - cargo build --release --verbose
    - cargo test --verbose
    - cargo package --verbose
  artifacts:
    paths:
      - target/doc
      - target/package/maud-pulldown-cmark-*.crate

test-beta:
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo --channel=beta
    - cargo build --release --verbose
    - cargo test --verbose

test-nightly:
  allow_failure: true
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo --channel=nightly
    - cargo build --release --verbose --features nightly
    - cargo test --verbose

image: ubuntu:vivid

stages:
  - test
  - publish

test-stable:
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo
    - cargo build --release --verbose
    - cargo test --verbose

test-beta:
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo --channel=beta
    - cargo build --release --verbose
    - cargo test --verbose

test-nightly:
  allow_failure: true
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo --channel=nightly
    - cargo build --release --verbose --features nightly
    - cargo test --verbose

publish:
  stage: publish
  only:
    - tags
  script:
    - apt-get install -y curl file build-essential
    - curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --disable-sudo
    - grep -v "maud_macros" Cargo.toml > Cargo.toml.new
    - mv Cargo.toml.new Cargo.toml
    - cargo build --release --verbose
    - cargo test --verbose
    - cargo package --verbose
    - cargo doc --verbose
    - cargo publish --token "$CRATES_IO_TOKEN"
  artifacts:
    paths:
      - target/doc
      - target/package/*.crate

Add in publish job for tags
Add in publish job for tags
