Skip to content

Commit ef098af

Browse files
committed
Adding to GitHub
0 parents  commit ef098af

30 files changed

Lines changed: 4854 additions & 0 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build.sh linguist-vendored

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: cssnr

.github/actionlint.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
paths:
2+
.github/workflows/**/*.{yml,yaml}:
3+
ignore:
4+
- '"inputs" section is alias node but mapping node is expected'
5+
- '"paths" section must be sequence node but got alias node with "" tag'
6+
- '"paths-ignore" section must be sequence node but got alias node with "" tag'
7+
.github/workflows/issue.yaml:
8+
ignore:
9+
- 'missing input "app-id" which is required by action "actions/create-github-app-token@v3"'
10+
- 'input "client-id" is not defined in action "actions/create-github-app-token@v3"'
11+
.github/workflows/test.yaml:
12+
ignore:
13+
- 'property ".+" is not defined in object type'

.github/assets/logo.svg

Lines changed: 10 additions & 0 deletions
Loading

.github/workflows/build.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: "Build"
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
inputs:
7+
tags:
8+
description: "Extra Tags: comma,separated"
9+
dev:
10+
description: "Development Build"
11+
type: boolean
12+
default: true
13+
#release:
14+
# types: [published]
15+
16+
env:
17+
dev: ${{ (inputs.dev || github.event.release.prerelease) && 'dev' || '' }}
18+
19+
jobs:
20+
build:
21+
name: "Build"
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 15
24+
25+
permissions:
26+
contents: write
27+
packages: write
28+
29+
environment:
30+
name: ghcr
31+
url: https://github.com/cssnr/chat-server/pkgs/container/chat-server
32+
33+
steps:
34+
- name: "Debug CTX github"
35+
if: ${{ !github.event.act }}
36+
continue-on-error: true
37+
env:
38+
GITHUB_CTX: ${{ toJSON(github) }}
39+
run: echo "$GITHUB_CTX"
40+
41+
- name: "Debug"
42+
continue-on-error: true
43+
run: |
44+
echo "github.ref_name: ${{ github.ref_name }}"
45+
echo "inputs.tags: ${{ inputs.tags }}"
46+
echo "inputs.dev: ${{ inputs.dev }}"
47+
echo "env.dev: ${{ env.dev }}"
48+
49+
- name: "Checkout"
50+
uses: actions/checkout@v6
51+
52+
- name: "Docker Login"
53+
uses: docker/login-action@v4
54+
with:
55+
registry: ghcr.io
56+
username: ${{ vars.GHCR_USER }}
57+
password: ${{ secrets.GHCR_PASS }}
58+
59+
- name: "Setup QEMU"
60+
uses: docker/setup-qemu-action@v4
61+
62+
- name: "Setup Buildx"
63+
uses: docker/setup-buildx-action@v4
64+
with:
65+
platforms: linux/amd64,linux/arm64
66+
67+
- name: "Update Version Tags"
68+
id: version
69+
uses: cssnr/update-version-tags-action@v2
70+
with:
71+
prefix: ""
72+
dry_run: true
73+
tags: |
74+
${{ inputs.tags }}
75+
76+
- name: "Debug Version Tags"
77+
continue-on-error: true
78+
run: |
79+
echo "github.ref_name: ${{ github.ref_name }}"
80+
echo "tags1: ${{ env.dev }}"
81+
echo "tags2: ${{ steps.version.outputs.tags }}"
82+
echo "tags3: ${{ inputs.tags }}"
83+
84+
- name: "Generate Docker Tags"
85+
id: tags
86+
uses: cssnr/docker-tags-action@v2
87+
with:
88+
images: "ghcr.io/${{ github.repository }}"
89+
tags: |
90+
${{ env.dev }}
91+
${{ steps.version.outputs.tags }}
92+
${{ inputs.tags }}
93+
94+
- name: "Debug Docker Tags"
95+
continue-on-error: true
96+
run: |
97+
echo "github.ref_name: ${{ github.ref_name }}"
98+
echo "tags: ${{ steps.tags.outputs.tags }}"
99+
echo "labels: ${{ steps.tags.outputs.labels }}"
100+
echo "annotations: ${{ steps.tags.outputs.annotations }}"
101+
102+
- name: "Build and Push"
103+
uses: docker/build-push-action@v7
104+
with:
105+
context: .
106+
push: true
107+
platforms: linux/amd64,linux/arm64
108+
tags: ${{ steps.tags.outputs.tags }}
109+
labels: ${{ steps.tags.outputs.labels }}
110+
annotations: ${{ steps.tags.outputs.annotations }}
111+
cache-from: type=gha
112+
cache-to: type=gha,mode=max
113+
build-args: |
114+
VERSION=${{ github.ref_name }}
115+
116+
- name: "Send Failure Notification"
117+
if: ${{ failure() }}
118+
uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0
119+
with:
120+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
121+
description: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/deploy.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "Deploy"
2+
3+
on:
4+
workflow_call:
5+
inputs: &inputs
6+
version:
7+
description: "Version Tag"
8+
required: false
9+
type: string
10+
workflow_dispatch:
11+
inputs: *inputs
12+
#workflow_run:
13+
# workflows: ["Build"]
14+
# types: [completed]
15+
16+
env:
17+
stack-file: docker-compose-swarm.yaml
18+
traefik-host: ${{ secrets.TRAEFIK_HOST }}
19+
stack-name: ${{ github.repository_owner }}-${{ github.event.repository.name }}
20+
version: ${{ inputs.version || github.event.workflow_run.head_branch || github.ref_name }}
21+
origins: "*.cssnr.com,cssnr.github.io,smashedr.github.io,django-files.github.io"
22+
23+
jobs:
24+
deploy:
25+
#if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
26+
name: "Deploy"
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 5
29+
30+
#environment:
31+
# name: swarm
32+
# url: https://chat-server.cssnr.com/
33+
34+
steps:
35+
- name: "Checkout"
36+
uses: actions/checkout@v6
37+
38+
- name: "Debug event.json"
39+
continue-on-error: true
40+
run: cat "${GITHUB_EVENT_PATH}"
41+
- name: "Debug CTX github"
42+
continue-on-error: true
43+
env:
44+
GITHUB_CTX: ${{ toJSON(github) }}
45+
run: echo "$GITHUB_CTX"
46+
- name: "Debug Environment"
47+
continue-on-error: true
48+
run: env
49+
50+
- name: "Debug"
51+
continue-on-error: true
52+
run: |
53+
echo "inputs.version: ${{ inputs.version }}"
54+
echo "github.event.workflow_run.head_branch: ${{ github.event.workflow_run.head_branch }}"
55+
echo "github.ref_name: ${{ github.ref_name }}"
56+
echo "env.version: ${{ env.version }}"
57+
58+
- name: "Portainer Deploy"
59+
uses: cssnr/portainer-stack-deploy-action@v1
60+
env:
61+
version: ${{ env.version == 'master' && 'latest' || env.version }}
62+
with:
63+
url: ${{ secrets.PORTAINER_URL }}
64+
token: ${{ secrets.PORTAINER_TOKEN }}
65+
file: ${{ env.stack-file }}
66+
name: ${{ env.stack-name }}
67+
username: ${{ vars.GHCR_USER }}
68+
password: ${{ secrets.GHCR_PASS }}
69+
type: file
70+
env_data: |
71+
VERSION: "${{ env.version }}"
72+
STACK_NAME: "${{ env.stack-name }}"
73+
TRAEFIK_HOST: "${{ env.traefik-host }}"
74+
BASIC_AUTH: "${{ secrets.BASIC_AUTH }}"
75+
GOOGLE_GENERATIVE_AI_API_KEY: "${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}"
76+
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
77+
MODEL: "${{ secrets.MODEL }}"
78+
CORS_ORIGINS: "${{ env.origins }}"
79+
MAX_TOKENS: "2048"
80+
81+
## https://render.com/docs/deploy-hooks#deploying-from-an-image-registry
82+
#- name: "Deploy Image"
83+
# uses: cssnr/web-request-action@v2
84+
# continue-on-error: true
85+
# env:
86+
# version: ${{ env.version == 'master' && 'latest' || env.version }}
87+
# with:
88+
# url: ${{ secrets.RENDER_HOOK }}
89+
# params: |
90+
# imgURL: ghcr.io/${{ github.repository }}:${{ env.version }}

.github/workflows/draft.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Draft Release"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [master, main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
draft:
14+
name: "Draft Release"
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 5
17+
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- name: "Checkout"
23+
uses: actions/checkout@v6
24+
25+
- name: "Draft Release Action"
26+
id: draft
27+
uses: cssnr/draft-release-action@master
28+
with:
29+
semver: patch
30+
prerelease: false
31+
32+
- name: "Process Release Draft URL"
33+
run: |
34+
echo "url: ${{ steps.draft.outputs.url }}"

.github/workflows/issue.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Issue"
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
issue:
9+
name: "Issue"
10+
if: ${{ !contains(github.event.issue.labels.*.name, 'enhancement') }}
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
14+
permissions:
15+
contents: write
16+
issues: write
17+
18+
steps:
19+
- name: "Checkout"
20+
uses: actions/checkout@v6
21+
22+
- name: "Create App Token"
23+
id: app
24+
uses: actions/create-github-app-token@v3
25+
with:
26+
client-id: 146360
27+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
28+
29+
- name: "AI Issue"
30+
uses: cssnr/ai-issue-action@v1
31+
env:
32+
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
33+
with:
34+
token: ${{ steps.app.outputs.token }}
35+
model: gemini-2.5-flash
36+
tail: |
37+
_Response generated by the [AI Issue Action](https://github.com/cssnr/ai-issue-action)._
38+
instructions: |
39+
You are a helpful assistant responding to a GitHub Issue created by user @${{ github.actor }}
40+
in the repository ${{ github.server_url }}/${{ github.repository }}
41+
Provide initial triage and troubleshooting steps, then gather any additional information needed to proceed.
42+
Respond using your general knowledge and the following knowledge files:
43+
path: |
44+
AGENTS.md
45+
README.md

.github/workflows/labeler.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "PR Labeler"
2+
3+
on:
4+
pull_request_target:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
labeler:
12+
name: "Labeler"
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
permissions:
17+
pull-requests: write
18+
issues: write
19+
20+
steps:
21+
- name: "Checkout Configs"
22+
uses: actions/checkout@v6
23+
with:
24+
repository: cssnr/configs
25+
ref: master
26+
path: .configs
27+
sparse-checkout-cone-mode: false
28+
sparse-checkout: |
29+
labels/**
30+
31+
- name: "Debug"
32+
continue-on-error: true
33+
run: |
34+
echo "::group::labels.yaml"
35+
cat .configs/labels/labels.yaml
36+
echo "::endgroup::"
37+
38+
echo "::group::labeler.yaml"
39+
cat .configs/labels/labeler.yaml
40+
echo "::endgroup::"
41+
42+
- name: "Label Creator"
43+
continue-on-error: true
44+
uses: cssnr/label-creator-action@v1
45+
with:
46+
file: .configs/labels/labels.yaml
47+
48+
- name: "Labeler"
49+
uses: actions/labeler@v6
50+
with:
51+
sync-labels: true
52+
configuration-path: .configs/labels/labeler.yaml

0 commit comments

Comments
 (0)