Add workflow (gitea)
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
|
51
install.sh
51
install.sh
@@ -1,51 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
PROJECT="dehydrate"
|
||||
|
||||
# RUN AS ROOT
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 0. see if we were passed a folder to install to
|
||||
# -----------------------------------------------------------------------------
|
||||
INSTALL_DIR="$1"
|
||||
if [[ -z "$INSTALL_DIR" ]]; then
|
||||
INSTALL_DIR="/usr/local/bin"
|
||||
else
|
||||
if [[ ! -d "$INSTALL_DIR" ]]; then
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
fi
|
||||
fi
|
||||
echo "Installing $PROJECT to $INSTALL_DIR"
|
||||
|
||||
# 1. Determine architecture
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
ARCH=$(uname -m)
|
||||
if [[ "$ARCH" == "x86_64" ]]; then
|
||||
BIN=$PROJECT.amd64
|
||||
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
|
||||
BIN=$PROJECT.arm64
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Download the appropriate binary
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
URL="https://gitea.jde.nz/public/$PROJECT/releases/download/latest/$BIN"
|
||||
echo "Downloading $BIN from $URL to $TMPDIR..."
|
||||
|
||||
curl -fsSL -o "$INSTALL_DIR/$PROJECT" "$URL"
|
||||
|
||||
# 4. Make it executable
|
||||
# -----------------------------------------------------------------------------
|
||||
chmod +x "$INSTALL_DIR/$PROJECT"
|
||||
|
||||
# 6. Print success message
|
||||
# -----------------------------------------------------------------------------
|
||||
echo "$PROJECT installed successfully to $INSTALL_DIR/$PROJECT (arch $ARCH)"
|
Reference in New Issue
Block a user