Publish RonDB Tarball #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: Publish RonDB Tarball | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "21.04.[0-9]+" | |
- "22.10.[0-9]+" | |
- "24.10.[0-9]+" | |
# This is important because the jobs are expensive and we don't want to wait a lot of time. | |
# This cancel-in-progress only works per branch, if a previous commit launched a job, a | |
# new one will cancel it. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
publish-arm-tarball: | |
runs-on: [self-hosted, ARM64] | |
if: github.repository == 'logicalclocks/rondb' | |
env: | |
REPO_HOPSWORKS_HOSTNAME: repo.hops.works | |
REPO_HOPSWORKS_USER: repo_upload | |
# The corresponding public key is added to the authorized_keys of the | |
# repo_upload user on the repo.hops.works server | |
SSH_PRIVATE_KEY: ${{ secrets.REPO_UPLOAD_SSH_PRIVATE_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up SSH | |
run: | | |
mkdir -p "$HOME/.ssh" | |
echo "$SSH_PRIVATE_KEY" > "$HOME/.ssh/id_ed25519" | |
chmod 600 "$HOME/.ssh/id_ed25519" | |
REPO_PUBLIC_KEY="repo.hops.works ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAvVvdl0/YDPeKNbg0AnCQQcFIXJV2WhuxcgQsjwj2+l" | |
# Check if known_hosts file exists, if not create it | |
KNOWN_HOSTS_FILE="$HOME/.ssh/known_hosts" | |
if [ ! -f "$KNOWN_HOSTS_FILE" ]; then | |
touch "$KNOWN_HOSTS_FILE" | |
chmod 644 "$KNOWN_HOSTS_FILE" | |
fi | |
# Add the host key to the known_hosts file if it is not already present | |
grep -qxF "$REPO_PUBLIC_KEY" "$KNOWN_HOSTS_FILE" || echo "$REPO_PUBLIC_KEY" >> "$KNOWN_HOSTS_FILE" | |
- run: cat ./MYSQL_VERSION | |
- name: Build RonDB Tarball | |
run: | | |
BUILD_CORES=$(nproc) | |
docker buildx build . \ | |
-f Dockerfile.oraclelinux8 \ | |
--target get-package-all \ | |
--output . \ | |
--build-arg BUILD_THREADS=$BUILD_CORES \ | |
--build-arg RELEASE_TARBALL=1 | |
ls -l | |
- name: Upload RonDB Tarball | |
run: | | |
tarball=$(ls rondb-*.tar.gz 2>/dev/null) | |
count=$(echo "$tarball" | wc -w) | |
if [[ $count -eq 0 ]]; then | |
echo "No tarball found starting with 'rondb-'" | |
exit 1 | |
elif [[ $count -gt 1 ]]; then | |
echo "Multiple tarballs found starting with 'rondb-':" | |
echo "$tarball" | |
exit 1 | |
fi | |
echo "Found tarball: $tarball" | |
host_user="$REPO_HOPSWORKS_USER@$REPO_HOPSWORKS_HOSTNAME" | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
# Manual dispatches will only be dev tarballs | |
echo "This workflow was triggered via a dispatch." | |
user_code_path="/opt/repository/master/rondb-dev" | |
else | |
echo "This workflow was not triggered by a dispatch." | |
user_code_path="/home/$REPO_HOPSWORKS_USER/upload_area" | |
fi | |
echo "Copying $tarball to $host_user:$user_code_path/" | |
scp ./$tarball $host_user:$user_code_path/ | |
# Delete the tarball after it has been uploaded | |
rm -f $tarball |