Deploy #2
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
name: Deploy | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Lint and Format with Ruff | |
run: | | |
pip install ruff | |
ruff check | |
ruff format | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
steps: | |
- name: ZeroTier | |
uses: zerotier/[email protected] | |
with: | |
network_id: ${{ secrets.ZEROTIER_NETWORK_ID }} | |
auth_token: ${{ secrets.ZEROTIER_CENTRAL_TOKEN }} | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Register Hibonite SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.HIBONITE_SSH_KEY }} | |
name: id_hibonite | |
known_hosts: ${{ secrets.HIBONITE_KNOWN_HOSTS }} | |
if_key_exists: replace | |
config: | | |
Host hibonite.gems.teknologiumum.com | |
HostName hibonite.gems.teknologiumum.com | |
User ${{ secrets.HIBONITE_SSH_USER }} | |
Port ${{ secrets.HIBONITE_SSH_PORT }} | |
IdentityFile ~/.ssh/id_hibonite | |
ServerAliveInterval 15 | |
- name: Register Tanzanite SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.TANZANITE_SSH_KEY }} | |
name: id_tanzanite | |
known_hosts: ${{ secrets.TANZANITE_KNOWN_HOSTS }} | |
if_key_exists: replace | |
config: | | |
Host tanzanite.gems.teknologiumum.com | |
HostName tanzanite.gems.teknologiumum.com | |
User ${{ secrets.TANZANITE_SSH_USER }} | |
Port ${{ secrets.TANZANITE_SSH_PORT }} | |
IdentityFile ~/.ssh/id_tanzanite | |
ServerAliveInterval 15 | |
- name: Register Painite SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.PAINITE_SSH_KEY }} | |
name: id_painite | |
known_hosts: ${{ secrets.PAINITE_KNOWN_HOSTS }} | |
if_key_exists: replace | |
config: | | |
Host painite.gems.teknologiumum.com | |
HostName painite.gems.teknologiumum.com | |
User ${{ secrets.PAINITE_SSH_USER }} | |
Port ${{ secrets.PAINITE_SSH_PORT }} | |
IdentityFile ~/.ssh/id_painite | |
ServerAliveInterval 15 | |
- name: Ping Hibonite Host | |
shell: bash | |
run: | | |
count=120 # 2 minutes | |
while ! ping -c 1 hibonite.gems.teknologiumum.com ; do | |
echo "waiting..." ; | |
sleep 1 ; | |
let count=count-1 | |
done | |
if [ $count -eq 0 ]; then | |
echo "Failed to ping hibonite.gems.teknologiumum.com" | |
exit 1 | |
fi | |
- name: Ping Tanzanite Host | |
shell: bash | |
run: | | |
count=120 # 2 minutes | |
while ! ping -c 1 tanzanite.gems.teknologiumum.com ; do | |
echo "waiting..." ; | |
sleep 1 ; | |
let count=count-1 | |
done | |
if [ $count -eq 0 ]; then | |
echo "Failed to ping tanzanite.gems.teknologiumum.com" | |
exit 1 | |
fi | |
- name: Ping Painite Host | |
shell: bash | |
run: | | |
count=120 # 2 minutes | |
while ! ping -c 1 painite.gems.teknologiumum.com ; do | |
echo "waiting..." ; | |
sleep 1 ; | |
let count=count-1 | |
done | |
if [ $count -eq 0 ]; then | |
echo "Failed to ping painite.gems.teknologiumum.com" | |
exit 1 | |
fi | |
- name: Execute setup file | |
run: python3 ./setup.py | |
env: | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
TANZANITE_SUDO_PASSWORD: ${{ secrets.TANZANITE_SUDO_PASSWORD }} | |
PAINITE_SUDO_PASSWORD: ${{ secrets.PAINITE_SUDO_PASSWORD }} | |
HIBONITE_SUDO_PASSWORD: ${{ secrets.HIBONITE_SUDO_PASSWORD }} |