Skip to content

Commit

Permalink
Merge pull request #3 from OpSecId/registrations
Browse files Browse the repository at this point in the history
Registrations
  • Loading branch information
PatStLouis authored Oct 16, 2024
2 parents 81a73dd + b43275f commit c5438aa
Show file tree
Hide file tree
Showing 60 changed files with 3,530 additions and 673 deletions.
34 changes: 34 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# For details on how this file works refer to:
# - https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
# Maintain dependencies for GitHub Actions
# - Check for updates once a week
# - Group all updates into a single PR
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
all-actions:
patterns: [ "*" ]

# Maintain dependencies for Python Packages
- package-ecosystem: "pip"
directory: "/server"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
timezone: "Canada/Pacific"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]

- package-ecosystem: "docker"
directory: "/server"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
timezone: "Canada/Pacific"
36 changes: 36 additions & 0 deletions .github/workflows/chart-releaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Charts

on:
release:
types: [published]

jobs:
release-charts:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
94 changes: 94 additions & 0 deletions .github/workflows/image-publisher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Publish Orgbook Publisher Image
run-name: Publish Orgbook Publisher ${{ inputs.tag || github.event.release.tag_name }} Image
on:
release:
types: [published]

workflow_dispatch:
inputs:
tag:
description: "Image tag"
required: true
type: string
platforms:
description: "Platforms - Comma separated list of the platforms to support."
required: true
default: linux/amd64
type: string
ref:
description: "Optional - The branch, tag or SHA to checkout."
required: false
type: string

permissions:
contents: read
packages: write

env:
PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64' }}

jobs:
publish-image:
if: github.repository_owner == 'OpSecId'
strategy:
fail-fast: false

name: Publish Orgbook Publisher Image
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || '' }}

- name: Gather image info
id: info
run: |
echo "repo-owner=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

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

- name: Setup Image Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/orgbook-publisher
tags: |
type=raw,value=${{ inputs.tag || github.event.release.tag_name }}
- name: Build and Push Image to ghcr.io
uses: docker/build-push-action@v6
with:
push: true
context: server/
file: server/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: ${{ env.PLATFORMS }}

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Linting stuff
.ruff_cache
.ruff_cache/

# Databases
app.db
Expand Down
11 changes: 5 additions & 6 deletions backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from fastapi import FastAPI, APIRouter
from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware
from app.routers import issuers, credentials, related_resources
from app.routers import registrations, credentials
from config import settings

app = FastAPI(title=settings.PROJECT_TITLE, version=settings.PROJECT_VERSION)


app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
Expand All @@ -16,14 +17,12 @@

api_router = APIRouter()

api_router.include_router(issuers.router, tags=["Issuers"])
api_router.include_router(credentials.router, tags=["Credentials"])
api_router.include_router(related_resources.router, tags=["Related Resources"])


@api_router.get("/server/status", tags=["Server"], include_in_schema=False)
async def server_status():
return JSONResponse(status_code=200, content={"status": "ok"})

api_router.include_router(credentials.router)
api_router.include_router(registrations.router)


app.include_router(api_router)
6 changes: 6 additions & 0 deletions backend/app/contexts/credentials_examples_v2.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@vocab": "https://www.w3.org/ns/credentials/examples#"
}
}

Loading

0 comments on commit c5438aa

Please sign in to comment.