-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cb63092
Showing
1,296 changed files
with
219,002 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.