Skip to content
Snippets Groups Projects

lobi.to gitlab-ci

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Harley Watson
    .gitlab-ci.yml 1.12 KiB
    # Based on https://rpadovani.com/aws-s3-gitlab
    
    variables:
      AWS_DEFAULT_REGION: eu-west-2
    
    stages:
      - build
      - deploy
    
    workflow:
      rules:
        - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
          variables:
            BUCKET_NAME: lobito-www
            ENVIRONMENT_NAME: main
            ENVIRONMENT_URL: https://lobi.to/
    
        - if: $CI_COMMIT_REF_NAME == "citesting"
          variables:
            BUCKET_NAME: test-lobito-www
            ENVIRONMENT_NAME: testing
            ENVIRONMENT_URL: https://eu-west-2.s3.amazonaws.com/test-lobito-www/
    
    build-yarn:
      image: node:16-alpine
      stage: build
      script:
        - yarn install
      artifacts:
        paths:
          - static/components/
    
    build-jeykll:
      image: ruby:2.6
      needs: ["build-yarn"]
      stage: build
      script:
        - bundle install --path vendor
        - bundle exec jekyll build -d public
      artifacts:
        paths:
          - public
      cache:
        paths:
          - vendor/
    
    deploy-s3:
      image: "registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest"
      needs: ["build-jeykll"]
      stage: deploy
      script:
        - aws s3 sync --delete public s3://${BUCKET_NAME}
      environment:
        name: $ENVIRONMENT_NAME
        url: $ENVIRONMENT_URL
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment