Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 22837960 authored by Sreeram R's avatar Sreeram R 🦇
Browse files

Clean up CI pipeline

parent 5e537a0b
Loading
Loading
Loading
Loading
+7 −17
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@
  before_script:
    - echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY

.docker-compose-base:
.deploy:
  image: alpine:latest
  stage: deploy
  before_script:
    - mkdir $HOME/.ssh
    - chmod 700 $HOME/.ssh
@@ -21,21 +22,14 @@
    - apk add --update --no-cache openssh rsync

.docker-compose-deploy:
  extends: .docker-compose-base
  extends: .deploy
  script:
    - echo "Deploying $CI_PROJECT_NAME to $CI_ENVIRONMENT_NAME"
    - |
      ssh $SSH_USER@$DEPLOYMENT_HOST /bin/bash -s << EOT
      set -eu
      mkdir -p $DEPLOYMENT_PATH
      cd $DEPLOYMENT_PATH
      if [ ! -d .git ]; then
        git init
        git remote add origin git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git
      else
        git remote set-url origin git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git
      fi
      git fetch origin
      git stash
      git fetch
      git checkout ${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}}
      EOT
    - |
@@ -54,7 +48,7 @@
      EOT

.docker-compose-recreate:
  extends: .docker-compose-base
  extends: .deploy
  script:
    - echo "Recreating stack on $DEPLOYMENT_HOST"
    - |
@@ -65,7 +59,7 @@
      EOT

check:
  stage: build
  stage: test
  image: node:23-alpine
  script:
    - cd app
@@ -93,7 +87,6 @@ docker-build-image-tag:
    - if: '$CI_COMMIT_BRANCH == "main"' 

deploy-stack:staging:
  stage: deploy
  extends: .docker-compose-deploy
  needs: ["docker-build-image-tag"]
  when: manual
@@ -105,7 +98,6 @@ deploy-stack:staging:
    url: $URL

recreate-stack:staging:
  stage: deploy
  extends: .docker-compose-recreate
  needs: ["deploy-stack:staging"]
  when: manual
@@ -117,7 +109,6 @@ recreate-stack:staging:
    url: $URL

deploy-stack:production:
  stage: deploy
  extends: .docker-compose-deploy
  needs: ["docker-build-image-tag"]
  when: manual
@@ -128,7 +119,6 @@ deploy-stack:production:
    url: $URL

recreate-stack:production:
  stage: deploy
  extends: .docker-compose-recreate
  needs: ["deploy-stack:production"]
  when: manual