diff --git a/.github/workflows/build-pull-request.yaml b/.github/workflows/build-main.yaml similarity index 74% rename from .github/workflows/build-pull-request.yaml rename to .github/workflows/build-main.yaml index 57a4bcbd..2f914b16 100644 --- a/.github/workflows/build-pull-request.yaml +++ b/.github/workflows/build-main.yaml @@ -1,10 +1,9 @@ - -name: Pull Request Build +name: Main Build on: - pull_request: - branches: [ main ] - + push: + branches: [main] + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 00000000..522afcb5 --- /dev/null +++ b/.github/workflows/build-release.yaml @@ -0,0 +1,10 @@ +name: Release Build + +on: + push: + tags: + - "*.*.*" + +jobs: + build: + uses: ./.github/workflows/workflow-build.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yaml similarity index 84% rename from .github/workflows/build.yml rename to .github/workflows/build.yaml index 6b3b0135..e744b8cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yaml @@ -1,9 +1,9 @@ name: Build on: - push: - branches: [ main ] - + pull_request: + branches: [main] + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yaml similarity index 94% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy.yaml index 29d772c8..7fe3e217 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yaml @@ -2,10 +2,9 @@ name: Deploy on: workflow_run: - workflows: [ Build ] - branches: [ main ] - types: [ completed ] - + workflows: ["Main Build"] + types: [completed] + concurrency: group: ${{ github.ref }} cancel-in-progress: false @@ -36,7 +35,7 @@ jobs: with: node-version: 18 - - name: Install AWS CDK + - name: Install AWS CDK run: | npm install -g aws-cdk diff --git a/.github/workflows/publish-docker-image.yaml b/.github/workflows/docker-build-and-publish.yaml similarity index 68% rename from .github/workflows/publish-docker-image.yaml rename to .github/workflows/docker-build-and-publish.yaml index 1dae6ba1..81d97726 100644 --- a/.github/workflows/publish-docker-image.yaml +++ b/.github/workflows/docker-build-and-publish.yaml @@ -1,9 +1,9 @@ -name: Release Build and Push +name: Docker Build and Push on: - push: - tags: - - "*.*.*" + workflow_run: + workflows: ["Release Build"] + types: [completed] env: REGISTRY_IMAGE_API: fynnfluegge/rocketnotes-api @@ -20,6 +20,10 @@ env: jobs: build-and-push: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: - name: Checkout code uses: actions/checkout@v4 @@ -30,6 +34,22 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - uses: dawidd6/action-download-artifact@v2 + with: + name: webapp-build + path: webapp/build + run_id: ${{ github.event.workflow_run.id }} + + - uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - uses: aws-actions/setup-sam@v2 + with: + use-installer: true + token: ${{ secrets.GITHUB_TOKEN }} + - run: sam build + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -44,10 +64,11 @@ jobs: uses: docker/build-push-action@v5 with: context: . + file: ./Dockerfile.sam platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.REGISTRY_IMAGE_API }}:${{ env.RELEASE_TAG }} + ${{ env.REGISTRY_IMAGE }}:${{ env.RELEASE_TAG }} ${{ env.REGISTRY_IMAGE_API }}:latest - name: Build and push Docker image webapp @@ -57,5 +78,5 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.REGISTRY_IMAGE_WEBAPP }}:${{ env.RELEASE_TAG }} + ${{ env.REGISTRY_IMAGE }}:${{ env.RELEASE_TAG }} ${{ env.REGISTRY_IMAGE_WEBAPP }}:latest diff --git a/.github/workflows/electron-build-and-publish.yaml b/.github/workflows/electron-build-and-publish.yaml new file mode 100644 index 00000000..87bc5f73 --- /dev/null +++ b/.github/workflows/electron-build-and-publish.yaml @@ -0,0 +1,64 @@ +name: Electron Build and Publish + +on: + workflow_run: + workflows: ["Release Build"] + types: [completed] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Build electron app + run: | + cd webapp + npm ci + npm run build-electron + env: + AWS_REGION: ${{ vars.AWS_REGION }} + DOMAIN_NAME: ${{ vars.DOMAIN_NAME }} + API_URL: ${{ vars.API_URL }} + COGNITO_USER_POOL_ID: ${{ vars.COGNITO_USER_POOL_ID }} + COGNITO_APP_CLIENT_ID: ${{ vars.COGNITO_APP_CLIENT_ID }} + REDIRECT_SIGN_IN: ${{ vars.REDIRECT_SIGN_IN }} + REDIRECT_SIGN_OUT: ${{ vars.REDIRECT_SIGN_OUT }} + AUTH_GUARD_REDIRECT: ${{ vars.AUTH_GUARD_REDIRECT }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@master + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Bundle and Publish electron + run: | + cd webapp + npm run bundle-electron + env: + AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }} + AWS_REGION: ${{ vars.AWS_REGION }} diff --git a/.github/workflows/workflow-build.yaml b/.github/workflows/workflow-build.yaml index 5176941e..8ad17ac9 100644 --- a/.github/workflows/workflow-build.yaml +++ b/.github/workflows/workflow-build.yaml @@ -1,4 +1,3 @@ - name: Reusable Build Workflow on: diff --git a/README.md b/README.md index 14ce58c7..42783d8f 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,15 @@ It utilizes a [100% Serverless RAG pipeline](https://medium.com/@fynnfluegge/ser [langchain](https://github.com/langchain-ai/langchain), [sentence-transformers](https://github.com/UKPLab/sentence-transformers), [faiss](https://github.com/facebookresearch/faiss), -[Ollama](https://github.com/jmorganca/ollama) and OpenAI or Anthropic. +[Ollama](https://github.com/jmorganca/ollama) and OpenAI or Anthropic. ## How to use - [Sign Up](https://takeniftynotes.auth.eu-central-1.amazoncognito.com/login?response_type=code&client_id=tt3v27pnqqh7elqdvq9tgmr9v&redirect_uri=https://app.takeniftynotes.net) for free - Run it 100% [locally with Docker](INSTALLATION.md#run-with-docker) - Host at [AWS](INSTALLATION.md#aws-hosting) -- Check [contributing guide](CONTRIBUTING.md#contributing-guide) how to setup a local development environment +- Check [Contribution Guide](CONTRIBUTING.md#contributing-guide) how to setup a local development environment + - If you are interested in contributing, visit [Contributing](README.md#Contributing) section for more details. ## ✨ Features @@ -41,7 +42,7 @@ It utilizes a [100% Serverless RAG pipeline](https://medium.com/@fynnfluegge/ser - 📥 Zettelkasten with semantic archiving - Use vector index to insert notes into highest semantic-ranked documents - WIP: Neovim plugin [rocketnotes.nvim](https://github.com/fynnfluegge/rocketnotes.nvim) - +