chore: add Build OneTable Domain Models step to deploy job. #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Services | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| NODE_VERSION: '20' | |
| YARN_VERSION: '1.22.22' | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build shared SDK | |
| run: yarn turbo run build --filter='@zeiro/sdk' | |
| - name: Build OneTable Domain Models | |
| run: yarn turbo run build --filter='@zeiro/domain' | |
| - name: Build CLI | |
| run: yarn install-cli | |
| - name: Type check | |
| run: yarn check-types | |
| - name: Lint | |
| run: yarn lint | |
| - name: Run tests | |
| run: yarn turbo run test --filter='./services/*' | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build shared SDK | |
| run: yarn turbo run build --filter='@zeiro/sdk' | |
| - name: Build OneTable Domain Models | |
| run: yarn turbo run build --filter='@zeiro/domain' | |
| - name: Build CLI | |
| run: yarn install-cli | |
| - name: Set environment variables | |
| run: | | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| echo "STAGE=prod" >> $GITHUB_ENV | |
| echo "ENV_NAME=production" >> $GITHUB_ENV | |
| else | |
| echo "STAGE=dev" >> $GITHUB_ENV | |
| echo "ENV_NAME=development" >> $GITHUB_ENV | |
| fi | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: "1.13.1" | |
| terraform_wrapper: false | |
| - name: Deploy Infrastructure | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| STAGE: ${{ env.STAGE }} | |
| run: yarn turbo run deploy --filter='./infrastructure/network' --filter='./infrastructure/storage' | |
| - name: Deploy Services | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| STAGE: ${{ env.STAGE }} | |
| run: yarn turbo run deploy --filter='./services/*' |