-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
8,846 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Publish package to GHCR and deploy | ||
name: Publish Canary package to GHCR and deploy | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Publish Utility package to GHCR and deploy | ||
|
||
on: | ||
push: | ||
branches: [util] | ||
workflow_dispatch: | ||
inputs: | ||
target_environment: | ||
description: 'Target environment' | ||
required: true | ||
default: production | ||
type: choice | ||
options: | ||
- production | ||
- development | ||
tag-release: | ||
type: boolean | ||
description: Tag release build | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}-utility | ||
|
||
|
||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=edge,branch=util | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}} | ||
type=raw,value=release,enable=${{ github.event_name == 'release' }} | ||
type=raw,value=release,enable=${{ github.event.inputs.tag-release == 'true' }} | ||
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | ||
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | ||
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | ||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./projects/VitalRecord.Utility | ||
file: ./projects/VitalRecord.Utility/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)." | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true | ||
deploy-aca: | ||
runs-on: ubuntu-latest | ||
needs: build-and-push-image | ||
environment: ${{ inputs.target_environment || 'production'}} | ||
steps: | ||
- name: Azure login | ||
uses: azure/login@v2 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: Deploy container | ||
uses: azure/container-apps-deploy-action@v2 | ||
with: | ||
imageToDeploy: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:edge | ||
containerAppName: utility | ||
resourceGroup: ${{ vars.ACA_RESOURCE_GROUP }} | ||
containerAppEnvironment: ${{ vars.ACA_APP_ENVIRONMENT }} | ||
disableTelemetry: true | ||
environmentVariables: | | ||
"COMMON_RATE_LIMIT_WINDOW_MS=1000" "COMMON_RATE_LIMIT_MAX_REQUESTS=20" "CORS_ORIGIN=*" "NODE_ENV=production" "PORT=443" | ||
- name: Update revision | ||
uses: azure/CLI@v2 | ||
with: | ||
azcliversion: latest | ||
inlineScript: | | ||
az containerapp update \ | ||
--name utility \ | ||
--resource-group ${{ vars.ACA_RESOURCE_GROUP }} \ | ||
--image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:edge \ | ||
--revision-suffix gha-${{ github.run_id }}-${{ github.run_attempt }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:recommended", "customManagers:biomeVersions"], | ||
"labels": ["chore: dependencies"], | ||
"dependencyDashboard": true, | ||
"lockFileMaintenance": { | ||
"enabled": true | ||
}, | ||
"packageRules": [ | ||
{ | ||
"matchUpdateTypes": ["minor", "patch", "pin", "digest"], | ||
"groupName": "all non-major dependencies", | ||
"groupSlug": "all-minor-patch", | ||
"automerge": true | ||
}, | ||
{ | ||
"matchPackageNames": ["@biomejs/biome"], | ||
"groupName": "biome", | ||
"groupSlug": "biome", | ||
"automerge": true | ||
}, | ||
{ | ||
"matchPackageNames": ["@commitlint/cli", "@commitlint/config-conventional"], | ||
"groupName": "commitlint", | ||
"groupSlug": "commitlint", | ||
"automerge": true | ||
}, | ||
{ | ||
"packagePatterns": ["@types", "typescript"], | ||
"groupName": "typescript" | ||
}, | ||
{ | ||
"packagePatterns": ["@vitest", "vitest"], | ||
"groupName": "vitest" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use the latest stable Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: "npm" | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Run Build | ||
run: npm run build |
22 changes: 22 additions & 0 deletions
22
projects/VitalRecord.Utility/.github/workflows/code-quality.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Code Quality | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Biome | ||
uses: biomejs/setup-biome@v2 | ||
with: | ||
version: latest | ||
|
||
- name: Run Biome | ||
run: biome ci . |
38 changes: 38 additions & 0 deletions
38
projects/VitalRecord.Utility/.github/workflows/docker-image.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Login step only executed for pushes to main | ||
- name: Login to GitHub Container Registry | ||
if: github.ref == 'refs/heads/master' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GH_Token }} | ||
|
||
# Build and tag the production Docker image | ||
- name: Build the Docker image | ||
run: | | ||
docker build . --file Dockerfile --tag ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
if [ "${{ github.ref }}" == "refs/heads/master" ]; then | ||
docker tag ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:latest | ||
fi | ||
# Push the production Docker image | ||
- name: Push the Docker image | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
docker push ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
docker push ghcr.io/${{ github.repository }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use the latest stable Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: "npm" | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Run Test | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
coverage | ||
node_modules | ||
dist | ||
build | ||
dist-ssr | ||
*.local | ||
.env | ||
|
||
# Editor directories and files | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run build | ||
npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
22.13.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM node:22.13.1-slim | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install app dependencies | ||
RUN npm ci | ||
|
||
# Bundle app source | ||
COPY . . | ||
|
||
# Build the TypeScript files | ||
RUN npm run build | ||
|
||
# Expose port 8080 | ||
EXPOSE 443 | ||
|
||
# Start the app | ||
CMD npm run start | ||
Check warning on line 22 in projects/VitalRecord.Utility/Dockerfile
|
Oops, something went wrong.