Hi everyone. New to SST, quick question. Would lik...
# sst
a
Hi everyone. New to SST, quick question. Would like to setup CI/CD using GitHub actions, AWS CodePipeline & CodeDeploy. Ultimately would like to have CI/CD for at least dev, qa, prod envs. Nothing unusual here. I understand how to do this with CDK but not clear to me from the CI/CD section of the SST docs how to approach this in an SST-idiomatic way. Can anyone point me in the right direction? Thanks!
t
I currently do everything in github actions - I'm not sure if I'm doing anything sst specific
Main thing is passing
--stage
appropriately
Ignore the testing step but here's my pretty simple setup
Copy code
name: sst

on:
  workflow_dispatch:
  push:
    paths:
    * "backend/**"
    * "solid/**"
    * "web/**"
    * "stacks/**"
    * ".github/workflows/sst.yaml"

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read

    steps:
    * name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"

    * uses: actions/checkout@v2
        with:
          fetch-depth: 0

    * uses: actions/setup-node@v1
        with:
          node-version: "14"

    * uses: actions/cache@v2
        name: Cache
        id: yarn-cache
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

    * name: Install Dependencies
        if: steps.yarn-cache.outputs.cache-hit != 'true'
        run: yarn

    * name: Typecheck
        run: yarn turbo run typecheck

    * if: github.ref != 'refs/heads/production'
        name: Configure Dev AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          role-to-assume: arn:aws:iam::386334411894:role/github
          aws-region: us-east-1

    * if: github.ref == 'refs/heads/production'
        name: Configure Production AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          role-to-assume: arn:aws:iam::706616489477:role/github
          aws-region: us-east-1


    * name: Deploy
        run: yarn sst deploy --stage=${GITHUB_REF_NAME}

    * name: Test
        if: github.ref != 'refs/heads/production'
        run: cd backend && SSM_PREFIX=/bumi/${GITHUB_REF_NAME}/ SSM_FALLBACK=/bumi/fallback/ SSM_VALUES=* yarn vitest
a
Thank you, Dax!