hmmm
This commit is contained in:
38
.gitea/workflows/BuildTestPublish.yaml
Normal file
38
.gitea/workflows/BuildTestPublish.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Build-Test-Publish
|
||||||
|
run-name: Build test and publish all tools
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Login to Gitea
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.jde.nz
|
||||||
|
username: DoesntMatter
|
||||||
|
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
./build.sh
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
./test.sh
|
||||||
|
- name: Publish
|
||||||
|
run: |
|
||||||
|
SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} \
|
||||||
|
RELEASE_WRITE_TOKEN=${{ secrets.RELEASE_WRITE_TOKEN }} \
|
||||||
|
GITEA_CONTAINER_NAME=${{ env.JOB_CONTAINER_NAME }} \
|
||||||
|
./publish.sh
|
90
install.sh
90
install.sh
@@ -1,69 +1,41 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
# Installs bb64 on the local machine.
|
# install bb64 using getpkg for current user.
|
||||||
# 1. determines the architecture of the local machine
|
|
||||||
# 2. downloads the appropriate bb64 binary from the latest public release on Gitea (https://gitea.jde.nz/public/bb64/releases)
|
|
||||||
# 3. makes the bb64 binary executable
|
|
||||||
# 4. moves the bb64 binary to /usr/local/bin
|
|
||||||
# 5. prints a message to the user
|
|
||||||
|
|
||||||
# 0. see if we were passed a folder to install to
|
PROJECT="bb64"
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
INSTALL_DIR="$1"
|
|
||||||
if [[ -z "$INSTALL_DIR" ]]; then
|
|
||||||
INSTALL_DIR="/usr/local/bin"
|
|
||||||
else
|
|
||||||
echo "Installing bb64 to $INSTALL_DIR"
|
|
||||||
if [[ ! -d "$INSTALL_DIR" ]]; then
|
|
||||||
mkdir -p "$INSTALL_DIR"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 0. see if we were passed a user to chown to
|
#SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
CHOWN_USER="$2"
|
|
||||||
if [[ -z "$CHOWN_USER" ]]; then
|
|
||||||
CHOWN_USER=$(id -u)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 1. Determine architecture
|
echo "Installing $PROJECT"
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
if [[ "$ARCH" == "x86_64" ]]; then
|
|
||||||
BIN=bb64.amd64
|
# check if getpkg is installed
|
||||||
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
|
GETPKG_PATH="${HOME}/.local/bin/getpkg/getpkg"
|
||||||
BIN=bb64.arm64
|
if [ ! -f "$GETPKG_PATH" ]; then
|
||||||
else
|
wget -nv "https://getbin.xyz/getpkg:latest-${ARCH}" -O bootstrap && chmod a+x bootstrap
|
||||||
echo "Unsupported architecture: $ARCH" >&2
|
./bootstrap install getpkg
|
||||||
|
rm ./bootstrap
|
||||||
|
|
||||||
|
if [ ! -f "$GETPKG_PATH" ]; then
|
||||||
|
echo "getpkg failed to install to $GETPKG_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "getpkg found in $GETPKG_PATH"
|
||||||
|
|
||||||
|
# install bb64
|
||||||
|
$GETPKG_PATH install $PROJECT
|
||||||
|
|
||||||
|
# confirm bb64 is installed
|
||||||
|
PROJPATH="${HOME}/.local/bin/getpkg/${PROJECT}"
|
||||||
|
if [ ! -f "$PROJPATH" ]; then
|
||||||
|
echo "getpkg failed to install $PROJECT to $PROJPATH"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Download the appropriate binary to a temp directory
|
# check version
|
||||||
# -----------------------------------------------------------------------------
|
VERSION=$(${PROJPATH} version)
|
||||||
TMPDIR=$(mktemp -d)
|
echo "${PROJECT} ${VERSION} installed"
|
||||||
trap 'rm -rf "$TMPDIR"' EXIT
|
|
||||||
URL="https://gitea.jde.nz/public/bb64/releases/download/latest/$BIN"
|
|
||||||
echo "Downloading $BIN from $URL..."
|
|
||||||
|
|
||||||
curl -fsSL -o "$TMPDIR/bb64" "$URL"
|
|
||||||
|
|
||||||
# 4. Make it executable
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
chmod +x "$TMPDIR/bb64"
|
|
||||||
|
|
||||||
# 5. Move to /usr/local/bin
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
docker run --rm -v "$TMPDIR:/tmp" -v "$INSTALL_DIR:/target" alpine sh -c "cp /tmp/bb64 /target/bb64; chown $CHOWN_USER /target/bb64"
|
|
||||||
rm "$TMPDIR/bb64"
|
|
||||||
|
|
||||||
# 6. Print success message
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
echo "bb64 installed successfully to $INSTALL_DIR/bb64 (arch $ARCH)"
|
|
||||||
# echo " "
|
|
||||||
# echo "Update bb64 with:"
|
|
||||||
# echo " bb64 -u"
|
|
||||||
# echo " "
|
|
||||||
# echo "try it out with:"
|
|
||||||
# echo " bb64 ZWNobyAiSGVsbG8td29ybGQhIGJiNjQgaXMgd29ya2luZy4i"
|
|
||||||
|
Reference in New Issue
Block a user