Skip to content

Commit

Permalink
feat(ci): add docker and electron build and publish to release tag pi…
Browse files Browse the repository at this point in the history
…peline (#159)
  • Loading branch information
fynnfluegge authored Nov 17, 2024
1 parent b22de29 commit 7fb8ed1
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Release Build

on:
push:
tags:
- "*.*.*"

jobs:
build:
uses: ./.github/workflows/workflow-build.yaml
6 changes: 3 additions & 3 deletions .github/workflows/build.yml → .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -36,7 +35,7 @@ jobs:
with:
node-version: 18

- name: Install AWS CDK
- name: Install AWS CDK
run: |
npm install -g aws-cdk
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
64 changes: 64 additions & 0 deletions .github/workflows/electron-build-and-publish.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 0 additions & 1 deletion .github/workflows/workflow-build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Reusable Build Workflow

on:
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

 

<div align="center">
Expand Down Expand Up @@ -104,9 +105,10 @@ It utilizes a [100% Serverless RAG pipeline](https://medium.com/@fynnfluegge/ser
<img src="landing-page/src/assets/tree.gif">
</div>


## Contributing

A good way to do the first contribution are the *good first issue* labelled issues [here](https://github.com/fynnfluegge/rocketnotes/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22). On some of the issues are already linked PRs with comments in the code what has to be done. These PRs can be picked up if not assigned to someone yet.

The most comfortable way to get started is to open the project in a ready-to-code Gitpod workspace with all packages & tools preinstalled and a running database with sample data.

<div align="center">
Expand All @@ -117,7 +119,7 @@ The most comfortable way to get started is to open the project in a ready-to-cod

&nbsp;

If you prefer to setup the project on your local machine see [contributing guide](CONTRIBUTING.md#contributing-guide) and learn all required steps to run it locally in development mode.
If you prefer to setup the project on your local machine see [Contributing Guide](CONTRIBUTING.md#contributing-guide) and learn all required steps to run it locally in development mode.

Don't hesitate to open an issue for getting some feedback about a potential bug or if you desire a missing feature.
It is appreciated to check over current [issues](https://github.com/fynnfluegge/rocketnotes/issues) and provide feedback to existing ones or even raise a PR which solves an issue.
Expand Down
2 changes: 1 addition & 1 deletion landing-page/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<a
class="nav-link border border-light rounded"
target="_blank"
href="https://rocketnotes-electron-releases.s3.eu-central-1.amazonaws.com/rocketnotes-1.0.2-arm64.dmg"
href="https://rocketnotes-electron-releases.s3.eu-central-1.amazonaws.com/rocketnotes-1.0.0-arm64.dmg"
style="margin-right: 8px"
>
<i class="fa-solid fa-download"></i> macOS <i class="fab fa-apple"></i>
Expand Down
2 changes: 1 addition & 1 deletion webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /root/

COPY ./build ./build
COPY package*.json ./
RUN npm install
RUN npm install --omit=dev
COPY server.js ./

EXPOSE 3001
Expand Down
4 changes: 2 additions & 2 deletions webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webapp",
"version": "1.0.2",
"version": "1.0.0",
"main": "electron.js",
"scripts": {
"ng": "ng",
Expand All @@ -12,7 +12,7 @@
"build": "npm run config-prod && ng build --configuration production",
"build-local": "export API_URL='http://localhost:3002' && npm run config-dev && ng build",
"build-electron": "npm run config-prod && ng build --configuration production --base-href ./",
"bundle-electron": "./node_modules/.bin/electron-builder",
"bundle-electron": "./node_modules/.bin/electron-builder --publish always",
"test": "ng test"
},
"private": true,
Expand Down

0 comments on commit 7fb8ed1

Please sign in to comment.