Skip to content

Commit

Permalink
CI deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
balegas committed Nov 6, 2024
1 parent 1e42675 commit dce24ba
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/deploy_linearlite.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion examples/linearlite/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down

0 comments on commit dce24ba

Please sign in to comment.