Skip to content

Commit 660be7f

Browse files
committed
feat: semantic versioning (#141)
1 parent c99bfa3 commit 660be7f

11 files changed

+215
-415
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Dockerfile
2+
.dockerignore
3+
node_modules
4+
npm-debug.log
5+
dist

.github/workflows/build-release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: docker build and push
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
build_and_publish:
9+
name: Build and publish replication-backend package
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Build and push
30+
uses: docker/build-push-action@v5
31+
with:
32+
platforms: linux/amd64
33+
context: ./
34+
push: true
35+
tags: ghcr.io/aam-digital/replication-backend:${{ github.event.release.tag_name }},ghcr.io/aam-digital/replication-backend:latest

.github/workflows/master-push.yml

-36
This file was deleted.

.github/workflows/pr-code-climate.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Code Climate on PR
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
code_climate:
8+
name: Code Climate code coverage
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
18+
- name: Install dependencies
19+
run: npm ci
20+
21+
- name: Run Tests with coverage
22+
run: npm run test:cov
23+
24+
- uses: paambaati/codeclimate-action@v5.0.0
25+
env:
26+
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_ID }}
27+
with:
28+
coverageLocations: coverage/lcov.info:lcov

.github/workflows/publish-release.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: publish release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
verify:
10+
name: Verify replication-backend
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run Tests with coverage
24+
run: npm run test:cov
25+
26+
- uses: paambaati/codeclimate-action@v5.0.0
27+
env:
28+
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_ID }}
29+
with:
30+
coverageLocations: coverage/lcov.info:lcov
31+
32+
publish:
33+
name: Publish Release
34+
runs-on: ubuntu-latest
35+
needs:
36+
- verify
37+
permissions:
38+
contents: write # to be able to publish a GitHub release
39+
issues: write # to be able to comment on released issues
40+
pull-requests: write # to be able to comment on released pull requests
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: 20
48+
49+
- name: Semantic Release
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
npx semantic-release

.github/workflows/pull-request-update.yml

-28
This file was deleted.

.releaserc.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"branches": ["master"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
[
7+
"@semantic-release/github",
8+
{
9+
"successComment": false,
10+
"failComment": false,
11+
"labels": false
12+
}
13+
]
14+
]
15+
}

Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM node:20-alpine
2+
3+
USER node
4+
5+
WORKDIR /usr/src/app
6+
7+
COPY --chown=node:node package*.json ./
8+
9+
# Some packages enable optimization when this is set
10+
ENV NODE_ENV="production"
11+
12+
RUN npm ci
13+
14+
COPY --chown=node:node . .
15+
16+
RUN npm run build
17+
18+
# The url of the CouchDB instance
19+
ENV DATABASE_URL="http://localhost:5984"
20+
# The user credentials which can access ALL data on the database
21+
ENV DATABASE_USER="demo"
22+
ENV DATABASE_PASSWORD="pass"
23+
# database name where the permissions definition document is stored
24+
ENV PERMISSION_DB="app"
25+
# A secret which is used to generate the cookies for user authentication
26+
ENV JWT_SECRET="jwtSecret"
27+
# The public key for verifying JWTs
28+
ENV JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n<PUBLIC_KEY>\n-----END PUBLIC KEY-----"
29+
# (optional) The sentry DSN in order to send the error messages to sentry
30+
ENV SENTRY_DSN=""
31+
# (optional) Port under which the app can be accessed. Default is 3000
32+
ENV PORT=""
33+
34+
# Start the server using the production build
35+
CMD [ "node", "dist/main.js" ]

build/Dockerfile

-70
This file was deleted.

0 commit comments

Comments
 (0)