diff --git a/.github/workflows/deploy_linearlite.yml b/.github/workflows/deploy_linearlite.yml new file mode 100644 index 0000000000..34420190f2 --- /dev/null +++ b/.github/workflows/deploy_linearlite.yml @@ -0,0 +1,52 @@ +name: Deploy production stack + +on: + push: + branches: ['main'] + paths: ['examples/linearlite/**'] + pull_request: + paths: ['examples/linearlite/**'] + +jobs: + deploy-production: + name: Deploy linearlite example + environment: Production + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Cache SST state + uses: actions/cache@v4 + with: + path: .sst + key: sst-cache-main-${{ runner.os }} + restore-keys: | + sst-cache-main-${{ runner.os }} + + - name: Initialize SST environment + run: | + sudo apt install -y tini + + - name: Deploy production stack + env: + 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 }} + # HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }} TODO + run: | + exec tini -s -g -- pnpm sst deploy --stage production \ No newline at end of file diff --git a/examples/linearlite/sst.config.ts b/examples/linearlite/sst.config.ts index c82e430822..08b334a419 100644 --- a/examples/linearlite/sst.config.ts +++ b/examples/linearlite/sst.config.ts @@ -86,7 +86,7 @@ function getNeonDbUri( async function addDatabaseToElectric( uri: string ): Promise<{ id: string; token: string }> { - const adminApi = process.env.ELECTRIC_ADMIN_HOST + const adminApi = process.env.ELECTRIC_ADMIN_API const result = await fetch(`${adminApi}/v1/databases`, { method: `PUT`,