Skip to content

Instantly share code, notes, and snippets.

@unicornware
Created May 19, 2022 02:52
Show Gist options
  • Select an option

  • Save unicornware/ba3e41628cef7e33b0bbf55d41636823 to your computer and use it in GitHub Desktop.

Select an option

Save unicornware/ba3e41628cef7e33b0bbf55d41636823 to your computer and use it in GitHub Desktop.

Revisions

  1. unicornware created this gist May 19, 2022.
    74 changes: 74 additions & 0 deletions pantheon-gitlab-workflow-setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,74 @@
    #!/bin/sh

    # PREREQUISITES
    #
    # 1. setup gpg for git
    # - https://medium.com/@jma/setup-gpg-for-git-on-macos-4ad69e8d3733
    # 2. install glab
    # - https://github.com/profclems/glab#installation
    # 3. install terminus
    # - https://pantheon.io/docs/terminus/install
    # 4. install lando
    # - https://docs.lando.dev/getting-started/installation.html
    # 5. find terminus upstream id
    # - terminus upstream:list
    # 6. set environment variables
    # - GITLAB_GROUP
    # - NODE_VERSION
    # - SITE
    # - SITE_DIR
    # - SITE_LABEL
    # - TERMINUS_FLAGS_SITE_CREATE
    # - TERMINUS_MACHINE_TOKEN
    # - UPSTREAM_ID

    # WORKFLOW START

    # create site directory and enter
    mkdir $SITE_DIR && cd $SITE_DIR

    # create new pantheon site
    # https://pantheon.io/docs/terminus/commands/site-create
    terminus site:create $SITE $SITE_LABEL $UPSTREAM_ID <options>

    # add sftp connection info (host, password, username) to ~/.ssh/config
    # https://pantheon.io/docs/terminus/commands/connection-info
    terminus connection:info $SITE.dev --fields 'sftp_*'

    # get initial site files from pantheon
    # https://docs.lando.dev/lando-101/lando-init.html
    lando init --source pantheon --pantheon-auth $TERMINUS_MACHINE_TOKEN --pantheon-site $SITE

    # init yarn 2 project
    # https://yarnpkg.com/getting-started/install#initializing-your-project
    yarn init -2

    # update gitignore (NOT using zero-installs)
    # https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

    # create .nvmrc
    echo $NODE_VERSION > .nvmrc

    # add package.json

    # add eslint, husky, lint-staged, markdownlint, prettier, and vscode configs

    # update readme with project specific info

    # add contributing guide

    # create gitlab repository under $GITLAB_GROUP using current directory name
    glab repo create --group $GITLAB_GROUP --defaultBranch next --tag pantheon

    # follow prompts; have glab run git init

    # stage all files
    git add .

    # make first commit
    git commit -S -m first commit

    # push to repo
    git push

    # WORKFLOW END