Skip to content

💬 Fix typo for SERVER_IP env in deploy workflow #258

💬 Fix typo for SERVER_IP env in deploy workflow

💬 Fix typo for SERVER_IP env in deploy workflow #258

Workflow file for this run

name: Build and maybe deploy to dothq.org
on:
push:
branches: ["production", "staging"]
workflow_dispatch:
env:
SERVER_HOSTNAME: "dothq-org"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: |
yarn
- name: Build
run: |
yarn build
- name: Test
run: |
yarn dev &
SERVER_PID=$!
while ! nc -z localhost 3000; do
sleep 0.1
done
yarn test
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/production'
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Connect to Tailscale network
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Install SSH key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.CI_PRIVATE_KEY }}" > ~/.ssh/id_rsa
SERVER_IP="$(tailscale ip -6 ${{ env.SERVER_HOSTNAME }})"
ssh-keyscan $SERVER_IP > ~/.ssh/known_hosts
- name: Connect over SSH and deploy
run: |
SERVER_IP="$(tailscale ip -6 ${{ env.SERVER_HOSTNAME }})"
ssh -t ci@$SERVER_IP "cd /app && git reset --hard && git pull && ./scripts/rebuild_docker.sh"
- name: Nuke SSH keys
run: rm -rf ~/.ssh