Skip to content

Commit 7fb8ed1

Browse files
authored
feat(ci): add docker and electron build and publish to release tag pipeline (#159)
1 parent b22de29 commit 7fb8ed1

File tree

11 files changed

+123
-29
lines changed

11 files changed

+123
-29
lines changed

.github/workflows/build-pull-request.yaml renamed to .github/workflows/build-main.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
2-
name: Pull Request Build
1+
name: Main Build
32

43
on:
5-
pull_request:
6-
branches: [ main ]
7-
4+
push:
5+
branches: [main]
6+
87
concurrency:
98
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
109
cancel-in-progress: true

.github/workflows/build-release.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Release Build
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
jobs:
9+
build:
10+
uses: ./.github/workflows/workflow-build.yaml

.github/workflows/build.yml renamed to .github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Build
22

33
on:
4-
push:
5-
branches: [ main ]
6-
4+
pull_request:
5+
branches: [main]
6+
77
concurrency:
88
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
99
cancel-in-progress: true

.github/workflows/deploy.yml renamed to .github/workflows/deploy.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ name: Deploy
22

33
on:
44
workflow_run:
5-
workflows: [ Build ]
6-
branches: [ main ]
7-
types: [ completed ]
8-
5+
workflows: ["Main Build"]
6+
types: [completed]
7+
98
concurrency:
109
group: ${{ github.ref }}
1110
cancel-in-progress: false
@@ -36,7 +35,7 @@ jobs:
3635
with:
3736
node-version: 18
3837

39-
- name: Install AWS CDK
38+
- name: Install AWS CDK
4039
run: |
4140
npm install -g aws-cdk
4241

.github/workflows/publish-docker-image.yaml renamed to .github/workflows/docker-build-and-publish.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Release Build and Push
1+
name: Docker Build and Push
22

33
on:
4-
push:
5-
tags:
6-
- "*.*.*"
4+
workflow_run:
5+
workflows: ["Release Build"]
6+
types: [completed]
77

88
env:
99
REGISTRY_IMAGE_API: fynnfluegge/rocketnotes-api
@@ -20,6 +20,10 @@ env:
2020
jobs:
2121
build-and-push:
2222
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
node-version: [18.x]
26+
2327
steps:
2428
- name: Checkout code
2529
uses: actions/checkout@v4
@@ -30,6 +34,22 @@ jobs:
3034
- name: Set up Docker Buildx
3135
uses: docker/setup-buildx-action@v3
3236

37+
- uses: dawidd6/action-download-artifact@v2
38+
with:
39+
name: webapp-build
40+
path: webapp/build
41+
run_id: ${{ github.event.workflow_run.id }}
42+
43+
- uses: actions/setup-python@v5
44+
with:
45+
python-version: "3.9"
46+
47+
- uses: aws-actions/setup-sam@v2
48+
with:
49+
use-installer: true
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
- run: sam build
52+
3353
- name: Login to Docker Hub
3454
uses: docker/login-action@v3
3555
with:
@@ -44,10 +64,11 @@ jobs:
4464
uses: docker/build-push-action@v5
4565
with:
4666
context: .
67+
file: ./Dockerfile.sam
4768
platforms: linux/amd64,linux/arm64
4869
push: true
4970
tags: |
50-
${{ env.REGISTRY_IMAGE_API }}:${{ env.RELEASE_TAG }}
71+
${{ env.REGISTRY_IMAGE }}:${{ env.RELEASE_TAG }}
5172
${{ env.REGISTRY_IMAGE_API }}:latest
5273
5374
- name: Build and push Docker image webapp
@@ -57,5 +78,5 @@ jobs:
5778
platforms: linux/amd64,linux/arm64
5879
push: true
5980
tags: |
60-
${{ env.REGISTRY_IMAGE_WEBAPP }}:${{ env.RELEASE_TAG }}
81+
${{ env.REGISTRY_IMAGE }}:${{ env.RELEASE_TAG }}
6182
${{ env.REGISTRY_IMAGE_WEBAPP }}:latest
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Electron Build and Publish
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Release Build"]
6+
types: [completed]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node-version: [18.x]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Cache node modules
19+
id: cache-npm
20+
uses: actions/cache@v3
21+
env:
22+
cache-name: cache-node-modules
23+
with:
24+
path: ~/.npm
25+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-build-${{ env.cache-name }}-
28+
${{ runner.os }}-build-
29+
${{ runner.os }}-
30+
31+
- name: Use Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
36+
- name: Build electron app
37+
run: |
38+
cd webapp
39+
npm ci
40+
npm run build-electron
41+
env:
42+
AWS_REGION: ${{ vars.AWS_REGION }}
43+
DOMAIN_NAME: ${{ vars.DOMAIN_NAME }}
44+
API_URL: ${{ vars.API_URL }}
45+
COGNITO_USER_POOL_ID: ${{ vars.COGNITO_USER_POOL_ID }}
46+
COGNITO_APP_CLIENT_ID: ${{ vars.COGNITO_APP_CLIENT_ID }}
47+
REDIRECT_SIGN_IN: ${{ vars.REDIRECT_SIGN_IN }}
48+
REDIRECT_SIGN_OUT: ${{ vars.REDIRECT_SIGN_OUT }}
49+
AUTH_GUARD_REDIRECT: ${{ vars.AUTH_GUARD_REDIRECT }}
50+
51+
- name: Configure AWS credentials
52+
uses: aws-actions/configure-aws-credentials@master
53+
with:
54+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
55+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
56+
aws-region: ${{ vars.AWS_REGION }}
57+
58+
- name: Bundle and Publish electron
59+
run: |
60+
cd webapp
61+
npm run bundle-electron
62+
env:
63+
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
64+
AWS_REGION: ${{ vars.AWS_REGION }}

.github/workflows/workflow-build.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Reusable Build Workflow
32

43
on:

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ It utilizes a [100% Serverless RAG pipeline](https://medium.com/@fynnfluegge/ser
1616
[langchain](https://github.com/langchain-ai/langchain),
1717
[sentence-transformers](https://github.com/UKPLab/sentence-transformers),
1818
[faiss](https://github.com/facebookresearch/faiss),
19-
[Ollama](https://github.com/jmorganca/ollama) and OpenAI or Anthropic.
19+
[Ollama](https://github.com/jmorganca/ollama) and OpenAI or Anthropic.
2020

2121
## How to use
2222

2323
- [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
2424
- Run it 100% [locally with Docker](INSTALLATION.md#run-with-docker)
2525
- Host at [AWS](INSTALLATION.md#aws-hosting)
26-
- Check [contributing guide](CONTRIBUTING.md#contributing-guide) how to setup a local development environment
26+
- Check [Contribution Guide](CONTRIBUTING.md#contributing-guide) how to setup a local development environment
27+
- If you are interested in contributing, visit [Contributing](README.md#Contributing) section for more details.
2728

2829
## ✨ Features
2930

@@ -41,7 +42,7 @@ It utilizes a [100% Serverless RAG pipeline](https://medium.com/@fynnfluegge/ser
4142
- 📥 Zettelkasten with semantic archiving
4243
- Use vector index to insert notes into highest semantic-ranked documents
4344
- WIP: Neovim plugin [rocketnotes.nvim](https://github.com/fynnfluegge/rocketnotes.nvim)
44-
45+
4546
 
4647

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

107-
108108
## Contributing
109109

110+
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.
111+
110112
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.
111113

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

118120
&nbsp;
119121

120-
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.
122+
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.
121123

122124
Don't hesitate to open an issue for getting some feedback about a potential bug or if you desire a missing feature.
123125
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.

landing-page/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<a
2424
class="nav-link border border-light rounded"
2525
target="_blank"
26-
href="https://rocketnotes-electron-releases.s3.eu-central-1.amazonaws.com/rocketnotes-1.0.2-arm64.dmg"
26+
href="https://rocketnotes-electron-releases.s3.eu-central-1.amazonaws.com/rocketnotes-1.0.0-arm64.dmg"
2727
style="margin-right: 8px"
2828
>
2929
<i class="fa-solid fa-download"></i> macOS <i class="fab fa-apple"></i>

webapp/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /root/
44

55
COPY ./build ./build
66
COPY package*.json ./
7-
RUN npm install
7+
RUN npm install --omit=dev
88
COPY server.js ./
99

1010
EXPOSE 3001

webapp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webapp",
3-
"version": "1.0.2",
3+
"version": "1.0.0",
44
"main": "electron.js",
55
"scripts": {
66
"ng": "ng",
@@ -12,7 +12,7 @@
1212
"build": "npm run config-prod && ng build --configuration production",
1313
"build-local": "export API_URL='http://localhost:3002' && npm run config-dev && ng build",
1414
"build-electron": "npm run config-prod && ng build --configuration production --base-href ./",
15-
"bundle-electron": "./node_modules/.bin/electron-builder",
15+
"bundle-electron": "./node_modules/.bin/electron-builder --publish always",
1616
"test": "ng test"
1717
},
1818
"private": true,

0 commit comments

Comments
 (0)