Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
898866c773 | ||
|
|
3b4215ef62 | ||
|
|
cc327f60c8 | ||
|
|
7e9a697bb2 | ||
|
|
2ac5d6579d | ||
|
|
234ae789c3 | ||
|
|
24b6bae55a | ||
|
|
c914ec5415 | ||
|
|
a5360130c2 | ||
|
|
41d1c47563 | ||
|
|
ccf6caa034 | ||
|
|
e8a96d75df | ||
|
|
95ddc7ca05 | ||
|
|
d86d62d69a | ||
|
|
9a885e8b83 | ||
|
|
da243f5c3f | ||
|
|
fc3e8debf3 | ||
|
|
a3348f4bd4 | ||
|
|
de8881b239 | ||
|
|
8fbcb15c98 | ||
|
|
c3a05096f4 | ||
|
|
e96c5dfaf8 | ||
|
|
9adc2f63b9 | ||
|
|
c1a832a01e | ||
|
|
8c972483af | ||
|
|
545944fa9b | ||
|
|
db7a3173f3 | ||
|
|
47722c7f5a | ||
|
|
f33bf869eb | ||
|
|
b4865a9913 | ||
|
|
936d518f47 | ||
|
|
a6f882a371 | ||
|
|
5b8a1426d1 | ||
|
|
ffc25a5f99 |
@@ -5,7 +5,12 @@ on:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '_docs/**'
|
||||
- '.docs/**'
|
||||
|
||||
env:
|
||||
DOCKER_REGISTRY: registry.dutchie031.net
|
||||
DOCKER_IMAGE: spearhead-docs
|
||||
DOCKER_TAG: latest
|
||||
|
||||
jobs:
|
||||
## Run replacements and cleanups on the docs
|
||||
@@ -17,16 +22,45 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
## --break-system-packages is used to avoid conflicts with system-installed packages on Ubuntu runners.
|
||||
- name: Install Python Pygments
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip --break-system-packages --no-cache-dir --ignore-installed
|
||||
pip install pygments --break-system-packages
|
||||
|
||||
- name: Highlight API code and update HTML
|
||||
run: |
|
||||
pygmentize -f html -l lua -O noclasses,style=monokai src/classes/api/SpearheadApiDoc.lua > .docs/web/pages/temp_api_code.html
|
||||
# Insert the highlighted code into the placeholder in spearheadapi.html
|
||||
sed -i '/@@API_CODE@@/r .docs/web/pages/temp_api_code.html' .docs/web/pages/spearheadapi.html
|
||||
sed -i '/@@API_CODE@@/d' .docs/web/pages/spearheadapi.html
|
||||
rm .docs/web/pages/temp_api_code.html
|
||||
|
||||
- name: Highlight API code and update HTML
|
||||
run: |
|
||||
pygmentize -f html -l lua -O noclasses,style=monokai ./config.lua > .docs/web/pages/temp_config_code.html
|
||||
# Insert the highlighted code into the placeholder in spearheadapi.html
|
||||
sed -i '/@@CONFIG_CODE@@/r .docs/web/pages/temp_config_code.html' .docs/web/pages/reference.html
|
||||
sed -i '/@@CONFIG_CODE@@/d' .docs/web/pages/reference.html
|
||||
rm .docs/web/pages/temp_config_code.html
|
||||
|
||||
- name: List files in .docs directory
|
||||
run: |
|
||||
echo "Listing files in .docs directory:"
|
||||
ls -R .docs
|
||||
|
||||
- name: Upload spearhead.lua artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: spearhead-docs
|
||||
path: ./.docs/**/*
|
||||
path: |
|
||||
./.docs/Dockerfile
|
||||
./.docs/web/**/*
|
||||
retention-days: 1
|
||||
|
||||
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare-docs
|
||||
steps:
|
||||
|
||||
# Download prepared pages from the previous job
|
||||
@@ -34,11 +68,61 @@ jobs:
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: spearhead-docs
|
||||
path: ./spearhead-docs
|
||||
|
||||
- name: DEBUG ls
|
||||
run: |
|
||||
ls -R ./spearhead-docs
|
||||
|
||||
- name: Build Docker image for docs
|
||||
run: |
|
||||
docker build -t spearhead-docs ./_docs
|
||||
docker build -t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} ./spearhead-docs
|
||||
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
|
||||
|
||||
|
||||
|
||||
deploy-container:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-image
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@v5
|
||||
with:
|
||||
version: 'latest'
|
||||
id: install
|
||||
|
||||
- name: Set up Kubeconfig
|
||||
run: |
|
||||
mkdir -p $HOME/.kube
|
||||
echo "${{ secrets.KUBECONFIG_CONTENT }}" > $HOME/.kube/config
|
||||
chmod 600 $HOME/.kube/config
|
||||
cat $HOME/.kube/config
|
||||
|
||||
- name: Run Helm upgrade/install
|
||||
run: |
|
||||
helm upgrade --install spearhead-docs .helm \
|
||||
--namespace spearhead-docs \
|
||||
--create-namespace \
|
||||
--set image.repository=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} \
|
||||
--set image.tag=${{ env.DOCKER_TAG }} \
|
||||
--wait
|
||||
|
||||
# - name: 'Deploy'
|
||||
# uses: deliverybot/helm@v1
|
||||
# with:
|
||||
# release: spearhead-docs
|
||||
# namespace: spearhead-docs
|
||||
# chart: '.helm'
|
||||
# value-files: >-
|
||||
# [
|
||||
# ".helm/values.yaml"
|
||||
# ]
|
||||
# env:
|
||||
# KUBECONFIG_FILE: ${{ secrets.KUBECONFIG_CONTENT }}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Values.app }}
|
||||
labels:
|
||||
app: {{ .Values.app }}
|
||||
namespace: spearhead-docs
|
||||
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Values.app }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.app }}
|
||||
spec:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 65534
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: {{ .Values.app }}
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.ports.containerPort }}
|
||||
volumeMounts:
|
||||
- name: cache
|
||||
mountPath: /var/cache/nginx
|
||||
- name: run
|
||||
mountPath: /var/run
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
volumes:
|
||||
- name: cache
|
||||
emptyDir: {}
|
||||
- name: run
|
||||
emptyDir: {}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.app }}
|
||||
namespace: spearhead-docs
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ .Values.app }}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.ports.servicePort }}
|
||||
targetPort: {{ .Values.ports.containerPort }}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ .Values.app }}-ingress
|
||||
namespace: spearhead-docs
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: spearhead.dutchie031.net
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ .Values.app }}
|
||||
port:
|
||||
number: {{ .Values.ports.servicePort }}
|
||||
# - host: spearhead.rocks
|
||||
# http:
|
||||
# paths:
|
||||
# - path: /
|
||||
# pathType: Prefix
|
||||
# backend:
|
||||
# service:
|
||||
# name: {{ .Values.app }}
|
||||
# port:
|
||||
# number: {{ .Values.ports.servicePort }}
|
||||
tls:
|
||||
- hosts:
|
||||
- spearhead.dutchie031.net
|
||||
#- spearhead.rocks
|
||||
secretName: spearhead-docs-tls
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
app: spearhead-docs
|
||||
|
||||
image:
|
||||
repository: registry.dutchie031.net/spearhead-docs
|
||||
tag: latest
|
||||
|
||||
ports:
|
||||
servicePort: 80
|
||||
containerPort: 80
|
||||
Reference in New Issue
Block a user