Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

⚙️ Build OpenSSH 📦 #11

⚙️ Build OpenSSH 📦

⚙️ Build OpenSSH 📦 #11

Workflow file for this run

name: ⚙️ Build OpenSSH 📦
#MAX_RUNTIME:
on:
workflow_dispatch:
schedule:
- cron: "15 18 * * *" # 12:00 AM Nepal Time Midnight EveryDay
env:
GITHUB_TOKEN: ${{ secrets.STATIC_TOOLBOX }}
jobs:
#------------------------------------------------------------------------------------#
# To list all bootlin ToolChains:
# curl -qfsSL "https://toolchains.bootlin.com/downloads/releases/toolchains/" | grep -oE 'href="[^"]+"' | awk -F'"' '{print $2}' | grep -E '^[^?/]' | sed 's:/$::'
# With the def settings in the def host, the following fail to compile (NOT Tested on containers):
# aarch64be
# armebv7-eabihf
#------------------------------------------------------------------------------------#
build-aarch64:
name: Build OpenSSH (ARCH=aarch64)
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
- name: Build OpenSSH
run: |
set -x ; set +e
# Git Clone Repo
cd $(mktemp -d) && git clone https://github.com/Azathothas/static-cross-openssh
cd "./static-cross-openssh" ; make switch-toolchain 2>/dev/null
# Make all
make -j$(nproc) ARCH=aarch64 PREFIX=/ all
# Extract & Put Everything in a sngle dir
find "./bin" -type f -name '*.tgz' -exec sh -c 'mkdir -p "${1%.tgz}" && tar -xzf "$1" -C "${1%.tgz}" --strip-components=1' sh {} \;
# rm the original .tgz & empty files
rm ./bin/*.tgz && find "./bin" -empty -delete
# create a new .tgz
find "./bin" -maxdepth 1 -type d -name '*openssh*' -exec tar -czf "{}.tgz" -C "$(dirname {})" "$(basename {})" \;
# Move to $pwd and rename
find ./bin -type f -name '*.tgz' -exec sh -c 'mv "$1" "$(basename "$1" .tgz)_$(ls ./toolchain | awk -F"--" "{print \$1}").tgz"' sh {} \;
# Extract name to GITHUB_ENV
export RELEASE_NAME="$(ls *.tgz)" && echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
export RELEASE_PATH="$(realpath $RELEASE_NAME)" && echo "RELEASE_PATH=$RELEASE_PATH" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NAME }}
path: ${{ env.RELEASE_PATH }}
#------------------------------------------------------------------------------------#
build-armv7-eabihf:
name: Build OpenSSH (ARCH=armv7-eabihf)
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
- name: Build OpenSSH
run: |
set -x ; set +e
# Get $VERSION
export OPENSSH_VERSION="$curl -qfsSL https://api.github.com/repos/openssh/openssh-portable/tags | jq -r '.[0].name')"
echo "OPENSSH_VERSION=$OPENSSH_VERSION" >> $GITHUB_ENV
# Git Clone Repo
cd $(mktemp -d) && git clone https://github.com/Azathothas/static-cross-openssh
cd "./static-cross-openssh" ; make switch-toolchain 2>/dev/null
# Make all
make -j$(nproc) ARCH=armv7-eabihf PREFIX=/ all
# Extract & Put Everything in a sngle dir
find "./bin" -type f -name '*.tgz' -exec sh -c 'mkdir -p "${1%.tgz}" && tar -xzf "$1" -C "${1%.tgz}" --strip-components=1' sh {} \;
# rm the original .tgz & empty files
rm ./bin/*.tgz && find "./bin" -empty -delete
# create a new .tgz
find "./bin" -maxdepth 1 -type d -name '*openssh*' -exec tar -czf "{}.tgz" -C "$(dirname {})" "$(basename {})" \;
# Move to $pwd and rename
find ./bin -type f -name '*.tgz' -exec sh -c 'mv "$1" "$(basename "$1" .tgz)_$(ls ./toolchain | awk -F"--" "{print \$1}").tgz"' sh {} \;
# Extract name to GITHUB_ENV
export RELEASE_NAME="$(ls *.tgz)" && echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
export RELEASE_PATH="$(realpath $RELEASE_NAME)" && echo "RELEASE_PATH=$RELEASE_PATH" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NAME }}
path: ${{ env.RELEASE_PATH }}
#------------------------------------------------------------------------------------#
build-x86-64:
name: Build OpenSSH (ARCH=x86-64)
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
- name: Build OpenSSH
run: |
set -x ; set +e
# Git Clone Repo
cd $(mktemp -d) && git clone https://github.com/Azathothas/static-cross-openssh
cd "./static-cross-openssh" ; make switch-toolchain 2>/dev/null
# Make all
make -j$(nproc) ARCH=x86-64 PREFIX=/ all
# Extract & Put Everything in a sngle dir
find "./bin" -type f -name '*.tgz' -exec sh -c 'mkdir -p "${1%.tgz}" && tar -xzf "$1" -C "${1%.tgz}" --strip-components=1' sh {} \;
# rm the original .tgz & empty files
rm ./bin/*.tgz && find "./bin" -empty -delete
# create a new .tgz
find "./bin" -maxdepth 1 -type d -name '*openssh*' -exec tar -czf "{}.tgz" -C "$(dirname {})" "$(basename {})" \;
# Move to $pwd and rename
find ./bin -type f -name '*.tgz' -exec sh -c 'mv "$1" "$(basename "$1" .tgz)_$(ls ./toolchain | awk -F"--" "{print \$1}").tgz"' sh {} \;
# Extract name to GITHUB_ENV
export RELEASE_NAME="$(ls *.tgz)" && echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
export RELEASE_PATH="$(realpath $RELEASE_NAME)" && echo "RELEASE_PATH=$RELEASE_PATH" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NAME }}
path: ${{ env.RELEASE_PATH }}
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
create-release:
name: Create OpenSSH Release
runs-on: ubuntu-latest
needs: [build-aarch64, build-armv7-eabihf, build-x86-64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Env
run: |
# Create tmp dir for releases
mkdir /tmp/releases
# Get $VERSION
export OPENSSH_VERSION="$(curl -qfsSL https://api.github.com/repos/openssh/openssh-portable/tags | jq -r '.[0].name')"
# If we get rate-limited, git clone the repo
if [ -z "$OPENSSH_VERSION" ]; then
cd $(mktemp -d) && git clone https://github.com/openssh/openssh-portable && cd openssh-portable
export OPENSSH_VERSION=$(git tag --sort=-creatordate | head -n 1)
fi
# Export it to ENV
echo "OPENSSH_VERSION=$OPENSSH_VERSION" >> $GITHUB_ENV
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: /tmp/releases
- name: List Artifacts
run: ls -laR /tmp/releases
- name: Releaser
uses: softprops/[email protected]
with:
name: "OpenSSH ${{ env.OPENSSH_VERSION }}"
tag_name: "openssh-${{ env.OPENSSH_VERSION }}"
prerelease: false
draft: false
generate_release_notes: false
token: "${{ secrets.GITHUB_TOKEN }}"
body: |
`Changelog`: _https://www.openssh.com/releasenotes.html_
`Install`: _https://github.com/Azathothas/static-toolbox/blob/master/README.md#openssh_
files: |
/tmp/releases/*/*
#------------------------------------------------------------------------------------#