diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfb3080009b115d0a4ad23c812c076e99e8c7c11..97c2e8e39dac1f20d9f0499705197b015d8d530d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,30 +1,29 @@ -build-job: - stage: build - tags: - - rcds - script: - - echo "Hello, $GITLAB_USER_LOGIN" +stages: + - build + - deploy -test-job1: - stage: test - tags: - - rcds - script: - - echo "This job tests something" +build: + stage: build + script: + # We simulate a build phase by manually creating files in a build folder + # An example would be using `yarn build` to build a react project that would create static files in a build or public folder + - mkdir -p public && cp data_science_journal_club_syllabus.html public/syllabus.html + artifacts: + when: on_success + paths: + - build/ + expire_in: 20 mins -test-job2: - stage: test - tags: - - rcds - script: - - echo "This job tests something, but takes more time than test-job1" - - echo "Sleeps for 20 seconds" - - sleep 20 -deploy-prod: - stage: deploy - tags: - - rcds - script: - - echo "This job deploys something from $CI_COMMIT_BRANCH branch." - environment: production +deploy: + stage: deploy + needs: + - build + image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest + rules: + - if: $CI_COMMIT_TAG # Run this job when a tag is created + script: + - echo "Running deploy" + - aws s3 cp --endpoint-url=https://s3.lts.rc.uab.edu ./public/syllabus.html s3://$S3_BUCKET/ --recursive + - echo "Deployment successful" +