Skip to content

Commit

Permalink
Fix: Branch main could not be tested easily
Browse files Browse the repository at this point in the history
This deploys the main branch automatically on the staging servers for system testing.
  • Loading branch information
hoh committed May 2, 2024
1 parent c7db4ef commit b658b01
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/deploy-main-on-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow automatically deploys main on staging
name: "Deploy `main` automatically on staging"

on:
push:
# branches:
# - main

jobs:
deploy_staging_servers:
name: "Deploying on ${{ matrix.staging_servers.hostname }}"
runs-on: ubuntu-latest
strategy:
matrix:
staging_servers:
- hostname: "ovh.staging.aleph.sh"
host_keys: | # Use `ssh-keyscan -H host` to obtain the host keys
|1|orGVLr9O7BxtBi/Z7x7IUNDCHqQ=|1dGYJsc6Qrz09BDzpdNGPKb3DKM= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDvpJciWglq3BlK1clNRcDNuPxUBxawlNjTIGdUv2j2MZ8+9bUZCJB5iqH+3onG9VIekTPumrlYWlS/fI/K37u8yQrnCrd6/WFoWYbNi2x5lR9Hsi5bEt80P0FArUZZJGsntPuXFxRFGwGxSD53vzeLne8V4eiLkCpc059c6UTpnnW/J7QFyseDCQr0W1l30Mr9gNmKnjAweKYwBKHXhn6TgRwTXOQ7UrBsw6CWt8r67h8BBvPt99ky8yxuL6gnSFXjyhr+5awYScuaUNIKptcbE9jHHxDcQKHstjFYDtl3BV7okPI/QbZnZR05St8/fWh+jy+vmGpSZkErBv6E0tXG08fvGayTW5aUqlQBiK32i6beQj+v27oJTZworwA9RBcT+jiBYTMUAiM2knXW0ijOebX3ZrJHNnPmrdn0SwRetiKG86HgQ+wwkGpwu1VM5y1em5pgETvu9Hx5E1JxBKqrwfGaMUQXVDXo2489mmWg05iAGz6HisSUdDHYQ+8gZp8=
|1|oS92sSDotqSXRoAz1JEKUvD8ULc=|5mHvAIWjnMB7b0rYQBZ4IpihYjA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFMjvE8AlBf1nJucFehBcIF6DO0tbNuOz8LyBQTt/6FQ0if2YP1ABuN0fauHOtxXLzonoHeaL6ZWBhjHfDex6V8=
|1|LsiOstaTi9lHXJQlX2XCw7CISSY=|i5G9ELrrtzZbE+GbcmauH218mY4= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJuASD1f5wgW3zgwqFjPWc8OF/AgZfHQUkyQ016sS+Fj
os: "debian-12"
make_target: "all-podman-debian-12"
artifact_name: "aleph-vm.debian-12.deb"

- hostname: "hetzner.staging.aleph.sh"
host_keys: |
|1|rq5/ijUdR9RR/2hUJxY6e+WxgYM=|HHkM5wCi0e1tLd/YAvB1fhRx6ZA= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDvpJciWglq3BlK1clNRcDNuPxUBxawlNjTIGdUv2j2MZ8+9bUZCJB5iqH+3onG9VIekTPumrlYWlS/fI/K37u8yQrnCrd6/WFoWYbNi2x5lR9Hsi5bEt80P0FArUZZJGsntPuXFxRFGwGxSD53vzeLne8V4eiLkCpc059c6UTpnnW/J7QFyseDCQr0W1l30Mr9gNmKnjAweKYwBKHXhn6TgRwTXOQ7UrBsw6CWt8r67h8BBvPt99ky8yxuL6gnSFXjyhr+5awYScuaUNIKptcbE9jHHxDcQKHstjFYDtl3BV7okPI/QbZnZR05St8/fWh+jy+vmGpSZkErBv6E0tXG08fvGayTW5aUqlQBiK32i6beQj+v27oJTZworwA9RBcT+jiBYTMUAiM2knXW0ijOebX3ZrJHNnPmrdn0SwRetiKG86HgQ+wwkGpwu1VM5y1em5pgETvu9Hx5E1JxBKqrwfGaMUQXVDXo2489mmWg05iAGz6HisSUdDHYQ+8gZp8=
|1|0NHnYZBjWoH9wGUXB4qD7x/iv68=|OvNcRso1gawWuXoDk567eK9pQ1A= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFMjvE8AlBf1nJucFehBcIF6DO0tbNuOz8LyBQTt/6FQ0if2YP1ABuN0fauHOtxXLzonoHeaL6ZWBhjHfDex6V8=
|1|V0i9hIon1ao2vVMpdCg64IKzWjY=|lQrPhlTT2XAhyuUprAFm+Gu52XI= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJuASD1f5wgW3zgwqFjPWc8OF/AgZfHQUkyQ016sS+Fj
os: "debian-12"
make_target: "all-podman-debian-12"
artifact_name: "aleph-vm.debian-12.deb"

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch the whole history for all tags and branches (required for aleph.__version__)
fetch-depth: 0

- run: |
cd packaging && make ${{ matrix.staging_servers.make_target }} && cd ..
ls packaging/target
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.staging_servers.artifact_name }}
path: packaging/target/${{ matrix.staging_servers.artifact_name }}

- name: Setup SSH private key
run: |
mkdir ~/.ssh
echo STAGING_SSH_PRIVATE_KEY | base64 --decode > ~/.ssh/id_ed25519
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/id_ed25519
env:
# Create using:
# ssh-keygen -t ed25519 -f ./id_ed25519
# cat ./id_ed25519 | base64 --wrap=0
STAGING_SSH_PRIVATE_KEY: ${{ secrets.STAGING_SSH_PRIVATE_KEY }}

- name: Install Aleph-VM on the Staging servers
run: |
echo ${{ matrix.staging_servers.host_keys }} > ~/.ssh/known_hosts
# Wait for /var/lib/apt/lists/lock to be unlocked on the remote host via SSH.
while ssh root@${SERVER_IPV4} lsof /var/lib/apt/lists/lock; do sleep 1; done
scp packaging/target/${{ matrix.staging_servers.package_name }} root@${SERVER_IPV4}:/opt
ssh root@${SERVER_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 install -y /opt/${{ matrix.staging_servers.package_name }}"
# Allow some time for IPFS Kubo to start
sleep 5

0 comments on commit b658b01

Please sign in to comment.