From 60f0ce56806a3c34acebcd590f0cfa1531949118 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 17 Sep 2024 18:11:55 -0600 Subject: [PATCH] first commit --- .changeset/README.md | 8 ++++ .changeset/config.json | 11 +++++ .dockerignore | 9 ++++ .github/workflows/deploy-next.yml | 46 +++++++++++++++++++++ .github/workflows/docker-image.yml | 66 ++++++++++++++++++++++++++++++ .github/workflows/pages.yml | 65 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 33 +++++++++++++++ .gitignore | 3 ++ .prettierignore | 4 ++ .prettierrc | 5 +++ .vscode/settings.json | 18 ++++++++ 11 files changed, 268 insertions(+) create mode 100644 .changeset/README.md create mode 100644 .changeset/config.json create mode 100644 .dockerignore create mode 100644 .github/workflows/deploy-next.yml create mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/pages.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .vscode/settings.json diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000..e5b6d8d --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..8fbb288 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "master", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5a2abc4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +node_modules +dist +.github +.vscode +.changeset +scripts +screenshots +relay +server/node_modules diff --git a/.github/workflows/deploy-next.yml b/.github/workflows/deploy-next.yml new file mode 100644 index 0000000..2b0975d --- /dev/null +++ b/.github/workflows/deploy-next.yml @@ -0,0 +1,46 @@ +name: Deploy Next Version +on: + push: + branches: + - next + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + steps: + - uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "npm" + + - name: Install dependencies + run: yarn + + - name: Build + run: yarn build + + - name: Redirect 404 to Index for SPA + run: cp dist/index.html dist/404.html + + - name: Deploy + uses: reggionick/s3-deploy@v4 + with: + folder: dist + bucket: "${{ secrets.S3_BUCKET }}" + bucket-region: us-east-1 + dist-id: "${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}" + invalidation: / + delete-removed: true + no-cache: true + private: true + files-to-include: "{.*/**,**}" diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..e23f662 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,66 @@ +name: Docker image + +on: + push: + branches: + - "**" + tags: + - "v*.*.*" + pull_request: + branches: + - "main" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=ref,event=branch + type=ref,event=pr + type=sha + + - name: Set build env + run: | + echo "VITE_COMMIT_HASH=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV + echo "VITE_APP_VERSION=$(jq -r .version ./package.json)" >> $GITHUB_ENV + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..c75d103 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,65 @@ +name: GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + tags: + - "v*.*.*" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "npm" + + - name: Install dependencies + run: yarn install + + - name: Set build env + run: | + echo "VITE_COMMIT_HASH=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV + echo "VITE_APP_VERSION=$(jq -r .version ./package.json)" >> $GITHUB_ENV + + - name: Build + run: yarn build + + - name: Redirect 404 to Index for SPA + run: cp dist/index.html dist/404.html + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: "./dist" + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..682567f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release + +on: + push: + branches: + - master + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Node.js 20 + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Install Dependencies + run: yarn + + - name: Create Release Pull Request + uses: changesets/action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2771441 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +dist +node_modules +stats.html diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ae3de1f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +node_modules +dist +public/lib +stats.html diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..054d599 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "tabWidth": 2, + "useTabs": false, + "printWidth": 120 +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..85c6328 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,18 @@ +{ + "cSpell.words": [ + "Bech", + "Chakra", + "damus", + "lnurl", + "Msat", + "nostr", + "noStrudel", + "Npub", + "pubkeys", + "Sats", + "webln" + ], + "typescript.enablePromptUseWorkspaceTsdk": true, + "typescript.tsdk": "node_modules/typescript/lib", + "deno.enable": false +}