Skip to content

Commit

Permalink
feat: semantic versioning (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwinter committed Apr 16, 2024
1 parent c99bfa3 commit 660be7f
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 415 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
dist
35 changes: 35 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: docker build and push

on:
release:
types: [released]

jobs:
build_and_publish:
name: Build and publish replication-backend package
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ./
push: true
tags: ghcr.io/aam-digital/replication-backend:${{ github.event.release.tag_name }},ghcr.io/aam-digital/replication-backend:latest
36 changes: 0 additions & 36 deletions .github/workflows/master-push.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/pr-code-climate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Code Climate on PR

on:
pull_request:

jobs:
code_climate:
name: Code Climate code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Run Tests with coverage
run: npm run test:cov

- uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_ID }}
with:
coverageLocations: coverage/lcov.info:lcov
53 changes: 53 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: publish release

on:
push:
branches:
- master

jobs:
verify:
name: Verify replication-backend
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Run Tests with coverage
run: npm run test:cov

- uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_ID }}
with:
coverageLocations: coverage/lcov.info:lcov

publish:
name: Publish Release
runs-on: ubuntu-latest
needs:
- verify
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
28 changes: 0 additions & 28 deletions .github/workflows/pull-request-update.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"successComment": false,
"failComment": false,
"labels": false
}
]
]
}
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:20-alpine

USER node

WORKDIR /usr/src/app

COPY --chown=node:node package*.json ./

# Some packages enable optimization when this is set
ENV NODE_ENV="production"

RUN npm ci

COPY --chown=node:node . .

RUN npm run build

# The url of the CouchDB instance
ENV DATABASE_URL="http://localhost:5984"
# The user credentials which can access ALL data on the database
ENV DATABASE_USER="demo"
ENV DATABASE_PASSWORD="pass"
# database name where the permissions definition document is stored
ENV PERMISSION_DB="app"
# A secret which is used to generate the cookies for user authentication
ENV JWT_SECRET="jwtSecret"
# The public key for verifying JWTs
ENV JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n<PUBLIC_KEY>\n-----END PUBLIC KEY-----"
# (optional) The sentry DSN in order to send the error messages to sentry
ENV SENTRY_DSN=""
# (optional) Port under which the app can be accessed. Default is 3000
ENV PORT=""

# Start the server using the production build
CMD [ "node", "dist/main.js" ]
70 changes: 0 additions & 70 deletions build/Dockerfile

This file was deleted.

Loading

0 comments on commit 660be7f

Please sign in to comment.