Skip to content

Commit

Permalink
feat: deploy worker from workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cptchloroplast committed Aug 6, 2024
1 parent ae58525 commit 508138e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,51 @@ name: terraform
on:
push:
paths:
- .github/workflows/terraform.yaml
- src/functions/**
- src/schemas/**
- src/services/**
- src/utils/**
- src/env.d.ts
- terraform/**
- .nvmrc
- .terraformignore
- .github/workflows/terraform.yaml
- drizzle.config.ts
- package.json
- tsconfig.json
concurrency: terraform
jobs:
node:
name: Build artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
- name: Build Worker
run: npm run build:worker
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build
terraform:
name: Deploy artifacts
runs-on: ubuntu-latest
needs: [node]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: build
path: build
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
Expand Down
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
"version": "6.6.6",
"private": true,
"scripts": {
"prebuild:creds": "scripts/get-credentials.sh",
"prebuild:bikes": "node scripts/get-bikes.mjs",
"prebuild": "npm-run-all prebuild:creds prebuild:bikes",
"build": "astro build",
"build": "npm-run-all build:blog test migrate:remote",
"build:blog": "astro build",
"build:worker": "esbuild src/functions/index.ts --bundle --outdir=build --platform=node --format=esm",
"clean": "rm -rf dist",
"migrate": "wrangler d1 migrations apply blog --local",
"start": "astro dev",
"migrate:local": "wrangler d1 migrations apply blog --local",
"migrate:remote": "wrangler d1 migrations apply blog --remote",
"start": "npm-run-all migrate:local start:blog",
"start:blog": "astro dev",
"start:worker": "wrangler dev src/functions/index.ts --show-interactive-dev-session false --test-scheduled",
"prepreview": "npm-run-all build",
"preview": "wrangler pages dev ./dist --show-interactive-dev-session false --port 5000",
"tail": "wrangler pages deployment tail --project-name blog",
"tail:blog": "wrangler pages deployment tail --project-name blog",
"tail:worker": "wrangler pages deployment tail --project-name blog-worker",
"pretest": "npm run build",
"test": "vitest run"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module "page" {
owner = var.github_owner
repo_name = var.github_repository
pages_hostname = var.pages_hostname
build_command = "npm test"

production_secrets = {
GOOGLE_CREDENTIALS = var.GOOGLE_CREDENTIALS
Expand Down

0 comments on commit 508138e

Please sign in to comment.