Skip to content

Commit

Permalink
collapsing commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Croft authored and Joshua Croft committed Jul 18, 2024
0 parents commit 6fc2c43
Show file tree
Hide file tree
Showing 830 changed files with 58,009 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules/
.nvmrc
.next/

k8s/

.git/
.gitignore
.gitmodules

.idea/
.vscode/

Dockerfile
.dockerignore

README.md
LICENSE

.eslintrc.json
next-env.d.ts
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BACKEND_URL=
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID=
NEXT_PUBLIC_ALGOLIA_APP_ID=
NEXT_PUBLIC_ALGOLIA_API_KEY=
NEXT_PUBLIC_ALGOLIA_INDEX=
NEWSLETTER_BASE_URL=
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tailwind.config.js
postcss.config.js
_app.js
next.config.js
index-data-to-algolia.js
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
settings: {
react: {
version: "detect",
},
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:unicorn/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react", "@typescript-eslint", "unicorn"],
rules: {
"unicorn/no-useless-undefined": ["error", { checkArguments: false }],
"unicorn/prevent-abbreviations": "off",
"unicorn/no-null": "off",
},
};
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches:
- master

pull_request:
branches:
- master

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"

- uses: pnpm/action-setup@v2
with:
version: 8.6.10

- name: Dependencies
run: |
pnpm install
- name: Build
run: |
pnpm run build
- name: Lint
run: |
pnpm run lint
- name: Formatting
run: |
pnpm run fmt:check
61 changes: 61 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy Production

on:
push:
branches:
- release/production

jobs:
build:
name: Build Images
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Gcloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.ORG_PRODUCTION_IMAGES_PUSH }}"

- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Set Image Tag
id: lookup
run: echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- run: |
gcloud auth list
gcloud auth configure-docker -q
echo "VERSION: ${{ steps.lookup.outputs.version }}"
- name: Build and Push Images
run: |
./k8s/build-img.py -p production
env:
BACKEND_URL: ${{ secrets.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }}
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }}
NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_API_KEY }}
NEXT_PUBLIC_ALGOLIA_INDEX: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX }}
NEWSLETTER_BASE_URL: ${{ secrets.NEWSLETTER_BASE_URL }}
SENDER_TOKEN: ${{ secrets.SENDER_TOKEN }}

- name: Trigger Image Update
run: |
curl -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ secrets.ORG_DISPATCH_RENDER_TOKEN }}" \
--request POST \
--data '{"event_type": "docs-build", "client_payload": {"image": "${{ env.IMAGE }}", "image_path": "${{ env.IMAGE_PATH }}", "key_path": "${{ env.KEY_PATH }}", "tag": "${{ env.TAG }}", "commit_message_service": "${{ env.SERVICE_NAME }}"}}' \
${{ env.TARGET_REPO }}
env:
IMAGE: gcr.io/fetch-ai-images/docs-website
KEY_PATH: ".website.image.tag"
TAG: ${{ steps.lookup.outputs.version }}
IMAGE_PATH: values
SERVICE_NAME: Documentation
TARGET_REPO: https://api.github.com/repos/fetchai/infra-production-deployment/dispatches
95 changes: 95 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Deploy Staging

on:
push:
branches:
- master

jobs:
build:
name: Build Images
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Gcloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}"

- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Set Image Tag
id: lookup
run: echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- run: |
gcloud auth list
gcloud auth configure-docker -q
echo "VERSION: ${{ steps.lookup.outputs.version }}"
- name: Build and Push Images
run: |
./k8s/build-img.py -p staging
env:
BACKEND_URL: ${{ secrets.STAGING_NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }}
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }}
NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_API_KEY }}
NEXT_PUBLIC_ALGOLIA_INDEX: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX }}
NEWSLETTER_BASE_URL: ${{ secrets.NEWSLETTER_BASE_URL }}
SENDER_TOKEN: ${{ secrets.SENDER_TOKEN }}

deploy:
name: Deployment
runs-on: ubuntu-latest

needs:
- build

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Gcloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}"

- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Set Image Tag
id: lookup
run: echo "version=$(git describe --always --dirty=-wip)" >> $GITHUB_OUTPUT

- name: Turnstyle
uses: softprops/turnstyle@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Staging
env:
IMAGE_TAG: ${{ steps.lookup.outputs.version }}
HELM_NAME: staging
NAMESPACE: docs-staging
GKE_PROJECT: fetch-ai-sandbox
GKE_CLUSTER: london-b
GKE_ZONE: europe-west2-b

run: |
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters get-credentials $GKE_CLUSTER \
--zone $GKE_ZONE \
--project $GKE_PROJECT
helm upgrade --install --wait --timeout 300s $HELM_NAME \
./k8s/docs/ \
--set-string website.image.tag=$IMAGE_TAG \
-n $NAMESPACE
50 changes: 50 additions & 0 deletions .github/workflows/ephemeral-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Clean Ephemeral Deployment

on:
pull_request:
types:
- closed

jobs:
clean-deployment:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Gcloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}"

- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Set Image Tag
id: lookup
run: echo "version=$(git describe --always --dirty=-wip)" >> $GITHUB_OUTPUT

- name: Turnstyle
uses: softprops/turnstyle@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Uninstall Deployment
env:
HELM_NAME: ephemeral-${{ github.event.pull_request.number }}
NAMESPACE: docs-staging
GKE_PROJECT: fetch-ai-sandbox
GKE_CLUSTER: london-b
GKE_ZONE: europe-west2-b
PR_NUMBER: ${{ github.event.pull_request.number }}
HELM_NAME_INGRESS: ephemeral-ingress-${{ github.event.pull_request.number }}

run: |
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters get-credentials $GKE_CLUSTER \
--zone $GKE_ZONE \
--project $GKE_PROJECT
helm uninstall $HELM_NAME -n $NAMESPACE
Loading

0 comments on commit 6fc2c43

Please sign in to comment.