stages: - build - lint - test - build_site - deploy - notify variables: CARGO_HOME: "$CI_PROJECT_DIR/cargo" DEFAULT_PIPELINE_NAME: "$CI_COMMIT_BRANCH - $CI_COMMIT_MESSAGE" SCHEDULED_PIPELINE_NAME: "Daily scheduled build pipeline" cache: paths: - target/ - cargo/ build: image: rust:latest stage: build script: - cargo build lint: image: rust:latest stage: lint script: - rustup component add clippy - cargo clippy --all-targets -- -D warnings rules: - if: $SCHEDULED_BUILD_PIPELINE == 'true' allow_failure: true - if: $SCHEDULED_BUILD_PIPELINE != 'true' allow_failure: false test: image: rust:latest stage: test script: - cargo test --verbose rules: - if: "$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH" build_site: image: rust:latest stage: build_site script: - cargo run - mv output public artifacts: paths: - public pages: stage: deploy script: - echo "Publishing site..." dependencies: - build_site artifacts: paths: - public rules: - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" indexnow: stage: notify needs: - pages script: - | curl -X POST "https://api.indexnow.org/indexnow" \ -H "Content-Type: application/json" \ -d '{ "host": "https://zine.ansonbiggs.com", "key": "2433b0850f38472a9dab36367deb89fc", "urlList": ["https://zine.ansonbiggs.com", "https://zine.ansonbiggs.com/feed.xml"], "keyLocation": "https://zine.ansonbiggs.com/2433b0850f38472a9dab36367deb89fc.txt" }' rules: - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" workflow: name: $CI_COMMIT_REF_NAME rules: - if: $SCHEDULED_BUILD_PIPELINE == 'true' variables: CI_COMMIT_REF_NAME: $SCHEDULED_PIPELINE_NAME - if: $SCHEDULED_BUILD_PIPELINE != 'true' variables: CI_COMMIT_REF_NAME: $DEFAULT_PIPELINE_NAME