sst: two more fixes. #157
Workflow file for this run
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: Teardown Examples PR stack | |
| on: | |
| pull_request: | |
| paths: ['examples/*/**'] | |
| types: [closed] | |
| concurrency: | |
| group: examples-pr-${{ github.event.number }} | |
| jobs: | |
| teardown-pr-stack: | |
| name: Teardown Examples PR stack | |
| environment: Pull request | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: | |
| [ | |
| 'yjs', | |
| 'linearlite-read-only', | |
| 'write-patterns', | |
| 'nextjs', | |
| 'todo-app', | |
| 'proxy-auth', | |
| 'phoenix-liveview', | |
| 'tanstack', | |
| 'remix', | |
| 'react', | |
| 'burn', | |
| ] | |
| env: | |
| DEPLOY_ENV: ${{ github.event_name == 'push' && 'production' || format('pr-{0}', github.event.number) }} | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_DEFAULT_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_DEFAULT_ACCOUNT_ID }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| NEON_API_KEY: ${{ secrets.NEON_API_KEY }} | |
| NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }} | |
| ELECTRIC_API: ${{ secrets.ELECTRIC_API }} | |
| ELECTRIC_ADMIN_API: ${{ secrets.ELECTRIC_ADMIN_API }} | |
| ELECTRIC_TEAM_ID: ${{ secrets.ELECTRIC_TEAM_ID }} | |
| ELECTRIC_ADMIN_API_AUTH_TOKEN: ${{ secrets.ELECTRIC_ADMIN_API_AUTH_TOKEN }} | |
| BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }} | |
| # HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }} TODO | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.tool-versions' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache SST state | |
| uses: actions/cache@v4 | |
| with: | |
| path: .sst | |
| key: sst-cache-${{ github.event.number }}-${{ runner.os }} | |
| restore-keys: | | |
| sst-cache-${{ runner.os }} | |
| - name: Remove ${{ matrix.example }} example | |
| working-directory: ./examples/${{ matrix.example }} | |
| run: | | |
| export PR_NUMBER=${{ github.event.number }} | |
| echo "Removing stage pr-$PR_NUMBER" | |
| # Run the command and capture both stdout and stderr | |
| if ! output=$(pnpm sst remove --stage "pr-$PR_NUMBER" 2>&1); then | |
| # Check if the error is because the stage doesn't exist | |
| if echo "$output" | grep -q "Stage not found"; then | |
| echo "Example was not deployed." | |
| exit 0 | |
| fi | |
| # If it's a different error, print it and fail | |
| echo "Error removing stage: $output" >&2 | |
| exit 1 | |
| fi | |
| echo "Successfully removed stage" | |
| exit 0 |