-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1288 from andrew-bierman/andrew_testing
Andrew testing
- Loading branch information
Showing
375 changed files
with
16,168 additions
and
5,058 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: 'Deploy worker' | ||
description: 'Deploys worker' | ||
inputs: | ||
WORKERS_AI_API_KEY: | ||
description: 'The Workers AI API Key' | ||
required: true | ||
VECTORIZE_API_KEY: | ||
description: 'The Vectorize API Key' | ||
required: true | ||
BUCKET_ACCESS_KEY_ID: | ||
description: 'The Bucket Access Key ID' | ||
required: true | ||
BUCKET_SECRET_KEY: | ||
description: 'The Bucket Secret Key' | ||
required: true | ||
GOOGLE_CLIENT_SECRET: | ||
description: 'The Google client secret' | ||
required: true | ||
JWT_SECRET: | ||
description: 'The JWT secret' | ||
required: true | ||
MAPBOX_ACCESS_TOKEN: | ||
description: 'The Mapbox access token' | ||
required: true | ||
OPENAI_API_KEY: | ||
description: 'The OpenAI API Key' | ||
required: true | ||
OPENWEATHER_KEY: | ||
description: 'The OpenWeather API Key' | ||
required: true | ||
REFRESH_TOKEN_SECRET: | ||
description: 'The refresh token secret' | ||
required: true | ||
SEND_GRID_API_KEY: | ||
description: 'The sendgrid API Key' | ||
required: true | ||
STMP_PASSWORD: | ||
description: 'The smtp password' | ||
required: true | ||
X_AMZ_SECURITY_TOKEN: | ||
description: 'The X-Amz-Security-Token' | ||
required: true | ||
JWT_VERIFICATION_KEY: | ||
description: 'The JWT verification key' | ||
required: true | ||
CLOUDFLARE_API_TOKEN: | ||
description: 'Cloudflare API Token' | ||
required: true | ||
CLOUDFLARE_ACCOUNT_ID: | ||
description: 'Cloudflare Account ID' | ||
required: true | ||
CLOUDFLARE_ENVIRONMENT: | ||
description: 'Cloudflare Environment' | ||
required: true | ||
type: choice | ||
options: | ||
- preview | ||
- production | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Deploy worker | ||
uses: cloudflare/[email protected] | ||
with: | ||
wranglerVersion: '3.75.0' | ||
apiToken: ${{ inputs.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} | ||
workingDirectory: server | ||
# INFO: We need to upload secret manually because the default secrets input of this action `cloudflare/[email protected]` use the `wrangler secret put` command to upload secrets but this command will do not work non-interactive context. | ||
preCommands: > | ||
echo '---Generate and upload secrets---' && | ||
echo '>> Generate secrets file' && | ||
echo '{}' | jq ' | ||
.BUCKET_ACCESS_KEY_ID="${{ inputs.BUCKET_ACCESS_KEY_ID }}" | | ||
.BUCKET_SECRET_KEY="${{ inputs.BUCKET_SECRET_KEY }}" | | ||
.GOOGLE_CLIENT_SECRET="${{ inputs.GOOGLE_CLIENT_SECRET }}" | | ||
.JWT_SECRET="${{ inputs.JWT_SECRET }}" | | ||
.JWT_VERIFICATION_KEY="${{ inputs.JWT_VERIFICATION_KEY }}" | | ||
.MAPBOX_ACCESS_TOKEN="${{ inputs.MAPBOX_ACCESS_TOKEN }}" | | ||
.OPENAI_API_KEY="${{ inputs.OPENAI_API_KEY }}" | | ||
.OPENWEATHER_KEY="${{ inputs.OPENWEATHER_KEY }}" | | ||
.REFRESH_TOKEN_SECRET="${{ inputs.REFRESH_TOKEN_SECRET }}" | | ||
.SEND_GRID_API_KEY="${{ inputs.SEND_GRID_API_KEY }}" | | ||
.STMP_PASSWORD="${{ inputs.STMP_PASSWORD }}" | | ||
.VECTORIZE_API_KEY="${{ inputs.VECTORIZE_API_KEY }}" | | ||
.WORKERS_AI_API_KEY="${{ inputs.WORKERS_AI_API_KEY }}" | | ||
.X_AMZ_SECURITY_TOKEN="${{ inputs.X_AMZ_SECURITY_TOKEN }}" | ||
' > secrets.json && | ||
echo '<< Secrets file generated' && | ||
echo '>> Upload secrets' && | ||
yarn wrangler secret bulk --env ${{ inputs.CLOUDFLARE_ENVIRONMENT }} secrets.json && | ||
echo '<< Secrets uploaded' | ||
command: deploy src/index.ts --env ${{ inputs.CLOUDFLARE_ENVIRONMENT }} | ||
packageManager: yarn | ||
env: | ||
CI: true | ||
NO_D1_WARNING: true | ||
WRANGLER_LOG: debug | ||
WRANGLER_LOG_SANITIZE: false | ||
|
||
- name: Print wrangler extra logs on failure | ||
if: failure() | ||
uses: ./.github/actions/print-wrangler-logs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: 'Migrate DB' | ||
description: 'Applies DB migrations' | ||
inputs: | ||
CLOUDFLARE_API_TOKEN: | ||
description: 'Cloudflare API Token' | ||
required: true | ||
CLOUDFLARE_ACCOUNT_ID: | ||
description: 'Cloudflare Account ID' | ||
required: true | ||
CLOUDFLARE_ENVIRONMENT: | ||
description: 'Cloudflare Environment' | ||
required: true | ||
type: choice | ||
options: | ||
- preview | ||
- production | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Migrate database | ||
uses: cloudflare/[email protected] | ||
with: | ||
wranglerVersion: '3.75.0' | ||
apiToken: ${{ inputs.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} | ||
workingDirectory: server | ||
preCommands: | | ||
nl -w1 -s': ' wrangler.toml | ||
command: | | ||
d1 migrations apply ${{ inputs.CLOUDFLARE_ENVIRONMENT }} --remote --env ${{ inputs.CLOUDFLARE_ENVIRONMENT }} | ||
packageManager: yarn | ||
env: | ||
NO_D1_WARNING: true | ||
CI: true | ||
WRANGLER_LOG: debug | ||
WRANGLER_LOG_SANITIZE: false | ||
|
||
- name: Print wrangler extra logs on failure | ||
if: failure() | ||
uses: ./.github/actions/print-wrangler-logs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: 'Print Wrangler Logs' | ||
description: 'Prints Wrangler logs files if exist' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Print the last wrangler log file | ||
shell: bash | ||
run: | | ||
cat "$(ls -t /home/runner/.config/.wrangler/logs/* 2> /dev/null | head -n 1)" 2> /dev/null || true; | ||
- name: Delete wrangler log files after printing | ||
shell: bash | ||
run: | | ||
rm /home/runner/.config/.wrangler/logs/* || true; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: 'Generate Wrangler TOML and Dotenv File' | ||
description: 'Generates wrangler.toml and .env files for Cloudflare Workers' | ||
inputs: | ||
APP_URL: | ||
description: 'The Application URL' | ||
required: true | ||
AWS_SIGN_ALGORITHM: | ||
description: 'The AWS sign algorithm' | ||
required: true | ||
BUCKET_ENDPOINT: | ||
description: 'The bucket endpoint' | ||
required: true | ||
BUCKET_NAME: | ||
description: 'The bucket name' | ||
required: true | ||
BUCKET_REGION: | ||
description: 'The bucket region' | ||
required: true | ||
BUCKET_SERVICE: | ||
description: 'The bucket service' | ||
required: true | ||
BUCKET_SESSION_TOKEN: | ||
description: 'The bucket session token' | ||
required: true | ||
environment: | ||
description: 'The current environment' | ||
required: true | ||
CLOUDFLARE_ACCOUNT_ID: | ||
description: 'Cloudflare Account ID' | ||
required: true | ||
DB_ID: | ||
description: 'The database ID' | ||
required: true | ||
GOOGLE_CLIENT_ID: | ||
description: 'Google Client ID' | ||
required: true | ||
STMP_EMAIL: | ||
description: 'SMTP Email' | ||
required: true | ||
VECTOR_INDEX_NAME: | ||
description: 'The vector index' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Generate wrangler.toml and .env | ||
shell: bash | ||
working-directory: ${{ github.workspace }}/server | ||
run: | | ||
echo 'NODE_ENV=development' > .env | ||
echo 'name = "packrat-api"' > wrangler.toml | ||
echo 'main = "src/index.ts"' >> wrangler.toml | ||
echo 'compatibility_date = "2024-03-14"' >> wrangler.toml | ||
echo 'node_compat = true' >> wrangler.toml | ||
echo '[env.${{ inputs.environment }}]' >> wrangler.toml | ||
echo '[[env.${{ inputs.environment }}.d1_databases]]' >> wrangler.toml | ||
echo 'binding = "DB"' >> wrangler.toml | ||
echo 'database_name = "${{ inputs.environment }}"' >> wrangler.toml | ||
echo 'database_id = "${{ inputs.DB_ID }}"' >> wrangler.toml | ||
echo 'migrations_dir = "${{ inputs.MIGRATIONS_PATH }}"' >> wrangler.toml | ||
echo '[[env.${{ inputs.environment }}.r2_buckets]]' >> wrangler.toml | ||
echo 'binding = "GEOJSON_BUCKET"' >> wrangler.toml | ||
echo 'bucket_name = "packrat-geojson-bucket-${{ inputs.environment }}"' >> wrangler.toml | ||
echo '[env.${{ inputs.environment }}.ai]' >> wrangler.toml | ||
echo 'binding = "AI"' >> wrangler.toml | ||
echo '[env.${{ inputs.environment }}.vars]' >> wrangler.toml | ||
echo 'APP_URL = "${{ inputs.APP_URL }}"' >> wrangler.toml | ||
echo 'AWS_SIGN_ALGORITHM = "${{ inputs.AWS_SIGN_ALGORITHM }}"' >> wrangler.toml | ||
echo 'BUCKET_ENDPOINT = "${{ inputs.BUCKET_ENDPOINT }}"' >> wrangler.toml | ||
echo 'BUCKET_NAME = "${{ inputs.BUCKET_NAME }}"' >> wrangler.toml | ||
echo 'BUCKET_REGION = "${{ inputs.BUCKET_REGION }}"' >> wrangler.toml | ||
echo 'BUCKET_SERVICE = "${{ inputs.BUCKET_SERVICE }}"' >> wrangler.toml | ||
echo 'BUCKET_SESSION_TOKEN = ${{ inputs.BUCKET_SESSION_TOKEN }}' >> wrangler.toml | ||
echo 'CLOUDFLARE_ACCOUNT_ID = "${{ inputs.CLOUDFLARE_ACCOUNT_ID }}"' >> wrangler.toml | ||
echo 'GOOGLE_CLIENT_ID = "${{ inputs.GOOGLE_CLIENT_ID }}"' >> wrangler.toml | ||
echo 'NODE_ENV = "${{ inputs.environment }}"' >> wrangler.toml | ||
echo 'OSM_URI = "https://overpass-api.de/api/interpreter"' >> wrangler.toml | ||
echo 'STMP_EMAIL = "${{ inputs.STMP_EMAIL }}"' >> wrangler.toml | ||
echo 'VECTOR_INDEX = "${{ inputs.VECTOR_INDEX_NAME }}"' >> wrangler.toml | ||
echo 'WEATHER_URL = "https://api.openweathermap.org/data/2.5/forecast"' >> wrangler.toml |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.