Compare commits
1 Commits
testing-ci
...
1ff1987e63
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ff1987e63 |
@@ -1,36 +0,0 @@
|
|||||||
name: Build and deploy
|
|
||||||
run-name: 🚀
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Login to container registry
|
|
||||||
uses: https://github.com/docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: https://git.vanespen.dev
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: https://github.com/docker/setup-buildx-action@v3
|
|
||||||
- name: Build and push
|
|
||||||
uses: https://github.com/docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
pull: true
|
|
||||||
no-cache: true
|
|
||||||
tags: "git.vanespen.dev/evanespen/blog:latest"
|
|
||||||
- name: Setup Kubectl
|
|
||||||
run: |
|
|
||||||
mkdir ~/.kube
|
|
||||||
echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config
|
|
||||||
export COMMIT_REF=$(git rev-parse HEAD)
|
|
||||||
echo $COMMIT_REF
|
|
||||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
|
||||||
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
|
||||||
sed -i "s/COMMIT_REF/$COMMIT_REF/g" argo.template.yaml
|
|
||||||
/usr/local/bin/kubectl apply --validate=false -f argo.template.yaml
|
|
||||||
17
Dockerfile
17
Dockerfile
@@ -1,17 +0,0 @@
|
|||||||
FROM archlinux as builder
|
|
||||||
|
|
||||||
RUN pacman -Syy \
|
|
||||||
&& pacman -S --noconfirm go dart-sass icu
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN go run .
|
|
||||||
|
|
||||||
FROM nginx:alpine
|
|
||||||
|
|
||||||
RUN rm -rf /usr/share/nginx/html/
|
|
||||||
|
|
||||||
COPY --from=builder /app/build/ /usr/share/nginx/html/
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
@@ -54,7 +54,7 @@ This is a personal blog built with Go, using the go-org library to parse Org-mod
|
|||||||
- [ ] footer
|
- [ ] footer
|
||||||
- [ ] resume page
|
- [ ] resume page
|
||||||
- [ ] contact page
|
- [ ] contact page
|
||||||
- [X] responsive
|
- [ ] responsive
|
||||||
- [ ] RSS
|
- [ ] RSS
|
||||||
- [ ] favicon
|
- [ ] favicon
|
||||||
- [ ] search
|
- [ ] search
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: argoproj.io/v1alpha1
|
|
||||||
kind: AppProject
|
|
||||||
metadata:
|
|
||||||
name: blog
|
|
||||||
namespace: argocd
|
|
||||||
spec:
|
|
||||||
description: Project for the blog application
|
|
||||||
sourceRepos:
|
|
||||||
- https://git.vanespen.dev/evanespen/blog
|
|
||||||
destinations:
|
|
||||||
- namespace: blog
|
|
||||||
server: https://kubernetes.default.svc
|
|
||||||
clusterResourceWhitelist:
|
|
||||||
- group: "*"
|
|
||||||
kind: "*"
|
|
||||||
namespaceResourceWhitelist:
|
|
||||||
- group: "*"
|
|
||||||
kind: "*"
|
|
||||||
syncWindows: []
|
|
||||||
roles: []
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: argoproj.io/v1alpha1
|
|
||||||
kind: Application
|
|
||||||
metadata:
|
|
||||||
name: blog-argo
|
|
||||||
namespace: argocd
|
|
||||||
spec:
|
|
||||||
project: blog
|
|
||||||
source:
|
|
||||||
repoURL: "https://git.vanespen.dev/evanespen/blog"
|
|
||||||
targetRevision: COMMIT_REF
|
|
||||||
path: "k8s"
|
|
||||||
destination:
|
|
||||||
server: "https://kubernetes.default.svc"
|
|
||||||
namespace: blog
|
|
||||||
syncPolicy:
|
|
||||||
automated:
|
|
||||||
prune: true
|
|
||||||
selfHeal: true
|
|
||||||
syncOptions:
|
|
||||||
- CreateNamespace=true
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export BLOG_ENV=dev
|
|
||||||
watchexec --restart -w ./ --no-process-group -- go run .
|
watchexec --restart -w ./ --no-process-group -- go run .
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
metadata:
|
|
||||||
name: blog-pod
|
|
||||||
namespace: blog
|
|
||||||
labels:
|
|
||||||
app: blog-pod
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: blog-container
|
|
||||||
image: git.vanespen.dev/evanespen/blog:latest
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: blog-service
|
|
||||||
namespace: blog
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: blog-pod
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 80
|
|
||||||
type: ClusterIP
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: traefik.io/v1alpha1
|
|
||||||
kind: IngressRoute
|
|
||||||
metadata:
|
|
||||||
name: blog-ingressroute
|
|
||||||
namespace: blog
|
|
||||||
spec:
|
|
||||||
entryPoints:
|
|
||||||
- websecure
|
|
||||||
routes:
|
|
||||||
- match: Host(`vanespen.dev`)
|
|
||||||
kind: Rule
|
|
||||||
services:
|
|
||||||
- name: blog-service
|
|
||||||
port: 80
|
|
||||||
tls:
|
|
||||||
certResolver: letsencrypt_dns
|
|
||||||
12
parse.go
12
parse.go
@@ -27,7 +27,6 @@ type Post struct {
|
|||||||
Content *org.Document // Parsed content of the post
|
Content *org.Document // Parsed content of the post
|
||||||
ReadTime uint8 // Estimated reading time in minutes
|
ReadTime uint8 // Estimated reading time in minutes
|
||||||
Hero string // URL path to the hero image for the post
|
Hero string // URL path to the hero image for the post
|
||||||
Draft bool // Is the article a draft (will not be rendered if so)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// listPosts reads the posts directory and returns a slice of Post structs.
|
// listPosts reads the posts directory and returns a slice of Post structs.
|
||||||
@@ -50,14 +49,8 @@ func listPosts() ([]Post, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("[!] Unable to parse ", filePath)
|
log.Println("[!] Unable to parse ", filePath)
|
||||||
} else {
|
} else {
|
||||||
if post.Draft {
|
|
||||||
if os.Getenv("BLOG_ENV") == "dev" {
|
|
||||||
posts = append(posts, post)
|
posts = append(posts, post)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
posts = append(posts, post)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(posts, func(i, j int) bool {
|
sort.Slice(posts, func(i, j int) bool {
|
||||||
@@ -110,10 +103,6 @@ func parseOrg(filePath string) (Post, error) {
|
|||||||
slug := orgData.Get("SLUG")
|
slug := orgData.Get("SLUG")
|
||||||
tags := strings.Split(orgData.Get("TAGS"), ", ")
|
tags := strings.Split(orgData.Get("TAGS"), ", ")
|
||||||
hero := path.Join("/medias", orgData.Get("HERO"))
|
hero := path.Join("/medias", orgData.Get("HERO"))
|
||||||
draft := true
|
|
||||||
if orgData.Get("DRAFT") == "false" {
|
|
||||||
draft = false
|
|
||||||
}
|
|
||||||
|
|
||||||
date, _ := time.Parse("2006-01-02", dateStr)
|
date, _ := time.Parse("2006-01-02", dateStr)
|
||||||
ts := date.Unix()
|
ts := date.Unix()
|
||||||
@@ -134,6 +123,5 @@ func parseOrg(filePath string) (Post, error) {
|
|||||||
Content: orgData,
|
Content: orgData,
|
||||||
ReadTime: uint8(readTime),
|
ReadTime: uint8(readTime),
|
||||||
Hero: hero,
|
Hero: hero,
|
||||||
Draft: draft,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ func compileSCSS() (string, error) {
|
|||||||
|
|
||||||
transpiler, err := godartsass.Start(godartsass.Options{})
|
transpiler, err := godartsass.Start(godartsass.Options{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("cannot start transpiler: ", err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
css, err := transpiler.Execute(args)
|
css, err := transpiler.Execute(args)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("cannot compile SCSS: ", err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("CSS compiled")
|
log.Println("CSS compiled")
|
||||||
|
|||||||
Reference in New Issue
Block a user