47 lines
1.8 KiB
YAML
47 lines
1.8 KiB
YAML
name: Publish new notes
|
|
run-name: Build in Quartz and push to Nginx
|
|
on: [push]
|
|
|
|
jobs:
|
|
build-quartz:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: oven/bun:latest
|
|
steps:
|
|
- name: Install Git
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y git
|
|
- name: Grab local files
|
|
uses: actions/checkout@v4
|
|
- name: Clone Quartz
|
|
run: git clone https://github.com/jackyzha0/quartz.git
|
|
- name: Copy notes to content directory
|
|
run: mkdir -p quartz/content && cp -r ./vlads-notes/* quartz/content
|
|
- name: Build Quartz
|
|
run: cd quartz && bun install && bun run quartz create && bun run quartz build
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: content
|
|
path: quartz/public
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: build-quartz
|
|
steps:
|
|
- name: Get artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: content
|
|
path: ./content
|
|
- name: Install kubectl
|
|
run: curl -LO https://dl.k8s.io/release/v1.33.0/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/bin
|
|
- name: Set up cluster access
|
|
run: mkdir ~/.kube && echo "${{ secrets.K8S_CONF }}" > ~/.kube/config
|
|
- name: Get target pods's name
|
|
run: echo "TARGET_POD=$(kubectl get pods -n my-stuff -l app=digital-garden -o json | jq -r .items[0].metadata.name)" >> "$GITHUB_ENV"
|
|
- name: Copy contents to pod temp folder (due to permission issues)
|
|
run: kubectl cp content my-stuff/$TARGET_POD:/tmp
|
|
- name: Change permissions and move files to WWW directory
|
|
run: kubectl exec -i -n my-stuff $TARGET_POD -- bash -c "chown -R 1000:1000 /tmp/content && rm -rf /www/data/* && mv /tmp/content/* /www/data"
|