Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 8141b53

Browse files
feat: gitpodify project (#189)
* feat: init gitpodify * fix: authentication to env-variable * fix: test authentication * fix: adjust other actions * feat: adjust gitpod.yml * feat: script order * fix: adjust gitpod.yml * fix: adjust gitpod.yml * fix: adjust gitpod.yml * fix: adjust gitpod.yml * feat: update gitpod.yml * revert: remove await port * feat: add delay * fix: delay to sleep * feat: remove preview * feat: update dockerfile * docs: update readme * feat: add gitpod button * feat: adjust prebuild settings Co-authored-by: Cahllagerfeld <Cahllagerfeld>
1 parent 306e226 commit 8141b53

File tree

9 files changed

+57
-21
lines changed

9 files changed

+57
-21
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ jobs:
1212
- uses: actions/setup-node@v2
1313
with:
1414
node-version: '16'
15-
- name: Authenticate with GitHub package registry
16-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
1715
- name: install dependencies
1816
run: npm ci
1917
env:
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2019
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2120
- name: lint check
2221
run: npm run lint
@@ -31,11 +30,10 @@ jobs:
3130
- uses: actions/setup-node@v2
3231
with:
3332
node-version: '16'
34-
- name: Authenticate with GitHub package registry
35-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
3633
- name: install dependencies
3734
run: npm ci
3835
env:
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3937
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
4038
- name: run build
4139
run: npm run build
@@ -65,11 +63,10 @@ jobs:
6563
uses: actions/setup-node@v2
6664
with:
6765
node-version: ${{ matrix.node-version }}
68-
- name: Authenticate with GitHub package registry
69-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
7066
- name: install dependencies
7167
run: npm ci
7268
env:
69+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7370
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
7471
- name: run unit tests
7572
run: npm run test

.github/workflows/docker.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v2
11-
- name: Authenticate with GitHub package registry
12-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
13-
- name: npm install
11+
- name: install dependencies
1412
run: npm ci
1513
env:
14+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1615
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
1716
- name: npm build
1817
run: npm run build
@@ -40,8 +39,6 @@ jobs:
4039
node-version: [16.x]
4140
steps:
4241
- uses: actions/checkout@v2
43-
- name: Authenticate with GitHub package registry
44-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
4542
- name: Use Node.js ${{ matrix.node-version }}
4643
uses: actions/setup-node@v2
4744
with:
@@ -50,9 +47,10 @@ jobs:
5047
with:
5148
name: artifacts
5249
path: dist
53-
- name: npm install
50+
- name: install dependencies
5451
run: npm ci
5552
env:
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5654
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
5755
- name: test
5856
run: npm test
@@ -83,6 +81,8 @@ jobs:
8381
with:
8482
context: .
8583
push: true
84+
secrets: |
85+
'GH_TOKEN=${{ secrets.GITHUB_TOKEN }}'
8686
build-args: 'github_token=${{ secrets.GITHUB_TOKEN }}'
8787
tags: |
8888
ghcr.io/eddiehubcommunity/api:v${{ steps.package-version.outputs.current-version}}

.github/workflows/docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
- uses: actions/setup-node@v2
1414
with:
1515
node-version: '16'
16-
- name: Authenticate with GitHub package registry
17-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
1816
- name: install dependencies
1917
run: npm ci
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2021
- name: build docs
2122
run: npm run docs
2223

.gitpod.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
2+
tasks:
3+
- name: Install npm depdencies
4+
init: |
5+
npm i -g npm
6+
npm install
7+
command: |
8+
npm i -g npm
9+
sleep 30
10+
npm run start:dev
11+
- name: Docker
12+
command: |
13+
docker-compose up
14+
15+
16+
github:
17+
prebuilds:
18+
# enable for the default branch (defaults to true)
19+
master: true
20+
# enable for all branches in this repo (defaults to false)
21+
branches: true
22+
# enable for pull requests coming from this repo (defaults to true)
23+
pullRequests: true
24+
# enable for pull requests coming from forks (defaults to false)
25+
pullRequestsFromForks: true
26+
# add a check to pull requests (defaults to true)
27+
addCheck: true
28+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
29+
addComment: true
30+
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
31+
addBadge: false

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@cahllagerfeld:registry=https://npm.pkg.github.com
2+
//npm.pkg.github.com/:_authToken=${GH_TOKEN}

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
FROM node:15 as development
22
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/api
33
ARG github_token
4+
ENV GH_TOKEN=${github_token}
45

56
WORKDIR /usr/src/app
67

8+
79
COPY package*.json ./
810
COPY .npmrc .npmrc
911

10-
RUN echo "//npm.pkg.github.com/:_authToken=${github_token}" > ~/.npmrc
1112
RUN npm install --ignore-scripts
1213
RUN rm -f .npmrc
1314

@@ -20,13 +21,13 @@ LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/api
2021
ARG github_token
2122
ARG NODE_ENV=production
2223
ENV NODE_ENV=${NODE_ENV}
24+
ENV GH_TOKEN=${github_token}
2325

2426
WORKDIR /usr/src/app
2527

2628
COPY package*.json ./
2729
COPY .npmrc .npmrc
2830

29-
RUN echo "//npm.pkg.github.com/:_authToken=${github_token}" > ~/.npmrc
3031
RUN npm install --production --ignore-scripts
3132

3233
COPY . .

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
Stargate - sign up with GitHub login for [FREE on DataStax Stargate](http://links.eddiejaoude.io/t/CiEQRydj4GdT) and get a NoSQL DB up in minutes with approximately `30 million reads, 5 million writes, and 40GB of storage per month for free` (Docker container also available)
99

10+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/EddieHubCommunity/api)
1011
## Description
1112

1213
An API to manage our community data
@@ -29,12 +30,15 @@ $ npm install
2930
```
3031

3132
## Running the app locally
32-
For connecting to Datastax Astra or a local stargate docker container the `nestjs-astra`-package is required. Its hosted in the Github-Package-Repository. For this reason you need to add the following sample to your local `.npmrc`.
33+
For connecting to Datastax Astra or a local stargate docker container the `nestjs-astra`-package is required. Its hosted in the Github-Package-Repository. For this reason you need to have an environment-variable called `GH_TOKEN`.
3334
```
34-
//npm.pkg.github.com/:_authToken=<Your personal Token>
35+
export GH_TOKEN=<Your token>
3536
```
3637
The Token can be generated in Github and needs the permission `package - read`. After this step you can run `npm install` as usual.
3738

39+
When using gitpod, you can set environment-variables under the following link `https://gitpod.io/variables`. You can even scope the variable to a specific project.
40+
41+
For connecting the API against the database you can use `docker-compose`
3842
```bash
3943
# database
4044
$ docker-compose up

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@
9696
"coverageDirectory": "../coverage",
9797
"testEnvironment": "node"
9898
}
99-
}
99+
}

0 commit comments

Comments
 (0)