Skip to content

Commit

Permalink
Merge branch 'main' into ci
Browse files Browse the repository at this point in the history
  • Loading branch information
peace-maker committed Apr 29, 2024
2 parents 10b6c7a + 885871c commit 03394d6
Show file tree
Hide file tree
Showing 2,030 changed files with 42,208 additions and 19,813 deletions.
13 changes: 0 additions & 13 deletions .env

This file was deleted.

27 changes: 27 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Pad

# Secure: we're using HTTPS
# CMD_PROTOCOL_USESSL=true

# Domain: you need to define this if you wish to enable any options
# CMD_DOMAIN=example.org:1337

# Content-Security Policy
# CMD_CSP_ENABLE=true

# Upload on filesystem (instead of imgur)
# CMD_IMAGE_UPLOAD_TYPE=filesystem

# USE_DISCORD=false
# DISCORD_BOT_TOKEN=secret_token
# DISCORD_SERVER_ID=server_id
# DISCORD_VOICE_CHANNELS=3
# DISCORD_BOT_NAME=CTFNote

# Configure timezone and locale
# TZ=Europe/Paris
# LC_ALL=en_US.UTF-8

# Can be generated with e.g. pwgen -s 64 1
# Please provide a string of length 64+ characters
# SESSION_SECRET=
60 changes: 60 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Build and publish Docker images to GHCR"

on:
workflow_dispatch:
push:
branches:
- "main"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
cancel-in-progress: true

permissions:
contents: read
packages: write

jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component: ["front", "api", "db"]
steps:
- name: PrepareReg Names
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
echo IMAGE_TAG=$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{split($0,a,"/"); print a[3]}') >> $GITHUB_ENV
echo IMAGE_REPOSITORY_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Generate Docker metadata for ${{ matrix.component }}
id: meta-data
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ env.IMAGE_REPOSITORY }}/${{ matrix.component }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64
context: ./${{ matrix.component }}
tags: ${{ steps.meta-data.outputs.tags }}
labels: ${{ steps.meta-data.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.component }}
cache-to: type=gha,scope=${{ matrix.component }}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": false,
"semi": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "es5"
}
Binary file not shown.
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.cjs
24 changes: 13 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CTFNote - Contribution Guide

When contributing to this repository, please first discuss the change you wish to make via issue with the collaborators of this repository before making a change.
We have a [Discord server](https://discord.gg/uzTybeYuBg) where we discuss the development and feature of CTFNote.

When contributing to this repository, please first discuss the change you wish to make via issue with the collaborators of this repository before making a change, or have a chat in Discord if you do not want to create a full issue yet.

## Git process

Expand Down Expand Up @@ -44,21 +46,22 @@ $ yarn
This should run the prepare script and install the linting pre-commit hooks:

```
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
$ husky install
[##] 2/2husky - Git hooks installed
✨ Done in 0.40s.
➤ YN0000: · Yarn 4.1.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done in 0s 103ms
```

### Start the third party containers

```shell
$ docker compose \
-f docker-compose.dev.yml \
up -d hedgedoc db adminer
up -d hedgedoc db
```

### Start the API
Expand All @@ -85,8 +88,7 @@ The following endpoint are exposed and can be used in the developpement environm
- [GraphiQL](http://localhost:3000/graphiql)
- [Hedgedoc](http://localhost:3001/)
- [Quasar APP](http://localhost:8088/)
- [Adminer](http://localhost:3002/?pgsql=db&username=ctfnote&db=ctfnote)

## Review

To merge a pull request, two distinct reviews from two different collaborators are required.
To merge a pull request, a review of a maintainer is required.
Loading

0 comments on commit 03394d6

Please sign in to comment.