Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanwahab committed Oct 19, 2024
0 parents commit cb63092
Show file tree
Hide file tree
Showing 1,296 changed files with 219,002 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/actions/auth_tailscale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Setup Tailscale
uses: tailscale/github-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
51 changes: 51 additions & 0 deletions .github/actions/deploy-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on: [push]

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy blog to hydrogen
if: github.ref == 'refs/heads/main'
env:
MACHINE: hydrogen
steps:
- name: Setup Go 1.17
id: go
uses: actions/setup-go@v2
with:
go-version: "^1.17"
- name: Setup Tailscale
id: tailscale
uses: tailscale/github-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
version: 1.7.359
- name: Add SSH key
id: ssh
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
run: |
mkdir -p ~/.ssh
MACHINE_IP="$(tailscale ip -6 $MACHINE)"
ssh-keyscan $MACHINE_IP >> ~/.ssh/known_hosts
printf "%s" "$SSH_KEY" > ~/.ssh/key
chmod 600 ~/.ssh/key
- name: Fetch code
id: fetch
uses: actions/checkout@v1

- name: Compile blog binary
id: compile
run: go build -o prose .

- name: Build tarball and ship it
id: tarball
run: |
TIME=$(date +%Y%m%d-%H%M%S)
FILENAME=prose-${TIME}.tar.gz
mkdir -p static/css
tar -czf $FILENAME prose static/ styles/ templates/ posts/
MACHINE_IP="$(tailscale ip -6 $MACHINE)"
echo $FILENAME "github@[$MACHINE_IP]:/home/github/"
scp -i ~/.ssh/key $FILENAME "github@[$MACHINE_IP]:/home/github/"
ssh -i ~/.ssh/key "github@$MACHINE_IP" "tar -C /var/www/blog -xzf ~/$FILENAME"
ssh -i ~/.ssh/key "github@$MACHINE_IP" "sudo systemctl restart prose"
30 changes: 30 additions & 0 deletions .github/workflows/git-pull.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Git Pull on Devices

on:
push:
branches:
- main

jobs:
pull-updates:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci

- name: Pull from all devices
env:
DEVICES: gpu, jetson-orin, jetson-nano-mini
run: |
IFS=',' read -r -a devices <<< "$DEVICES"
for device in "${devices[@]}"; do
ssh -o StrictHostKeyChecking=no adnan@$device "cd /home/adnan/homelab_status_page && git pull origin main"
done
Loading

0 comments on commit cb63092

Please sign in to comment.