From 1334f9314b9a87099324178fea769f74181c9c83 Mon Sep 17 00:00:00 2001
From: William E Warriner <wwarr@uab.edu>
Date: Thu, 10 Aug 2023 13:18:20 -0500
Subject: [PATCH] target s3 bucket

---
 .gitlab-ci.yml | 53 +++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dfb3080..97c2e8e 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"
+
-- 
GitLab