Publish Release #29
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 Release | |
on: | |
workflow_dispatch: | |
inputs: | |
channel: | |
description: 'Release Channel' | |
required: true | |
default: 'releases' | |
type: choice | |
options: | |
- downloads | |
- downloads-staging | |
env: | |
STAGING_DIR: staging/my-devices/sdk | |
STAGING_HOST: web.macchina.io | |
ARCHIVE_PREFIX: macchina-remote-sdk | |
jobs: | |
release_win64: | |
runs-on: windows-2022 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Build | |
run: | | |
cmake -G "Visual Studio 17 2022" -A x64 -S. -Bcmake-build | |
cmake --build cmake-build --config Release | |
- | |
name: Sign | |
run: | | |
echo '${{ secrets.SIGNING_CERT }}' >CodeSigningCert.b64 | |
certutil -decode CodeSigningCert.b64 CodeSigningCert.pfx | |
& 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\signtool.exe' sign /f CodeSigningCert.pfx /p '${{ secrets.SIGNING_PASS }}' /tr http://timestamp.digicert.com /td sha256 /fd sha256 /v cmake-build\\bin\\Release\\*.exe | |
- | |
name: Zip | |
run: 7z a -tzip remote-clients.zip cmake-build\bin\Release\*.exe | |
- | |
name: Install SSH Key | |
run: | | |
mkdir ~/.ssh | |
echo '${{ secrets.MACCHINA_IO_SSH_HOST_KEY }}' >~/.ssh/known_hosts | |
echo '${{ secrets.MACCHINA_SSH_KEY }}' >~/.ssh/id_rsa | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@${env:STAGING_HOST} mkdir -p ${env:STAGING_DIR}/${env:GITHUB_SHA}/bin/windows/10/AMD64/ | |
scp cmake-build\bin\Release\*.exe remote-clients.zip ${{ secrets.MACCHINA_USER }}@${env:STAGING_HOST}:${env:STAGING_DIR}/${env:GITHUB_SHA}/bin/windows/10/AMD64/ | |
release_ubuntu2004: | |
runs-on: ubuntu-20.04 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Install Packages | |
run: sudo apt update && sudo apt install cmake ninja-build libssl-dev | |
- | |
name: Build | |
run: cmake -H. -Bcmake-build -GNinja && cmake --build cmake-build --target all | |
- | |
name: Strip | |
run: strip cmake-build/bin/* | |
- | |
name: GZip | |
run: | | |
(cd cmake-build/bin && tar cfz ../../remote-clients.tar.gz remote-*) | |
gzip cmake-build/bin/* | |
- | |
name: Install SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.MACCHINA_IO_SSH_HOST_KEY }}' >~/.ssh/known_hosts | |
echo '${{ secrets.MACCHINA_SSH_KEY }}' >~/.ssh/id_rsa | |
chmod go-rwx ~/.ssh/id_rsa | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST mkdir -p $STAGING_DIR/$GITHUB_SHA/bin/ubuntu/20.04/x86_64 | |
scp cmake-build/bin/*.gz remote-clients.tar.gz ${{ secrets.MACCHINA_USER }}@$STAGING_HOST:$STAGING_DIR/$GITHUB_SHA/bin/ubuntu/20.04/x86_64 | |
release_ubuntu2204: | |
runs-on: ubuntu-20.04 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Install Packages | |
run: sudo apt update && sudo apt install cmake ninja-build libssl-dev | |
- | |
name: Build | |
run: cmake -H. -Bcmake-build -GNinja && cmake --build cmake-build --target all | |
- | |
name: Strip | |
run: strip cmake-build/bin/* | |
- | |
name: GZip | |
run: | | |
(cd cmake-build/bin && tar cfz ../../remote-clients.tar.gz remote-*) | |
gzip cmake-build/bin/* | |
- | |
name: Install SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.MACCHINA_IO_SSH_HOST_KEY }}' >~/.ssh/known_hosts | |
echo '${{ secrets.MACCHINA_SSH_KEY }}' >~/.ssh/id_rsa | |
chmod go-rwx ~/.ssh/id_rsa | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST mkdir -p $STAGING_DIR/$GITHUB_SHA/bin/ubuntu/22.04/x86_64 | |
scp cmake-build/bin/*.gz remote-clients.tar.gz ${{ secrets.MACCHINA_USER }}@$STAGING_HOST:$STAGING_DIR/$GITHUB_SHA/bin/ubuntu/22.04/x86_64 | |
release_raspberrypi: | |
runs-on: raspberrypi | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Build | |
run: cmake -H. -Bcmake-build -GNinja && cmake --build cmake-build --target all | |
- | |
name: Strip | |
run: strip cmake-build/bin/* | |
- | |
name: GZip | |
run: | | |
(cd cmake-build/bin && tar cfz ../../remote-clients.tar.gz remote-*) | |
gzip cmake-build/bin/* | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST mkdir -p $STAGING_DIR/$GITHUB_SHA/bin/raspberrypi/bullseye/armv7l | |
scp cmake-build/bin/*.gz remote-clients.tar.gz ${{ secrets.MACCHINA_USER }}@$STAGING_HOST:$STAGING_DIR/$GITHUB_SHA/bin/raspberrypi/bullseye/armv7l | |
release_macos12_x86_64: | |
runs-on: macos-12 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Install Packages | |
run: brew install openssl@3 ninja | |
- | |
name: Build | |
run: cmake -H. -Bcmake-build -GNinja -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3 -DOPENSSL_USE_STATIC_LIBS=TRUE && cmake --build cmake-build --target all | |
- | |
name: Strip | |
run: strip cmake-build/bin/* | |
- | |
name: GZip | |
run: | | |
(cd cmake-build/bin && tar cfz ../../remote-clients.tar.gz remote-*) | |
gzip cmake-build/bin/* | |
- | |
name: Install SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.MACCHINA_IO_SSH_HOST_KEY }}' >~/.ssh/known_hosts | |
echo '${{ secrets.MACCHINA_SSH_KEY }}' >~/.ssh/id_rsa | |
chmod go-rwx ~/.ssh/id_rsa | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST mkdir -p $STAGING_DIR/$GITHUB_SHA/bin/macos/monterey/x86_64 | |
scp cmake-build/bin/*.gz remote-clients.tar.gz ${{ secrets.MACCHINA_USER }}@$STAGING_HOST:$STAGING_DIR/$GITHUB_SHA/bin/macos/monterey/x86_64 | |
release_macos12_arm64: | |
runs-on: macos-12-arm64 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Build | |
run: cmake -H. -Bcmake-build -GNinja -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3 -DOPENSSL_USE_STATIC_LIBS=TRUE && cmake --build cmake-build --target all | |
- | |
name: Strip | |
run: strip cmake-build/bin/* | |
- | |
name: GZip | |
run: | | |
(cd cmake-build/bin && tar cfz ../../remote-clients.tar.gz remote-*) | |
gzip cmake-build/bin/* | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST mkdir -p $STAGING_DIR/$GITHUB_SHA/bin/macos/monterey/arm64 | |
scp cmake-build/bin/*.gz remote-clients.tar.gz ${{ secrets.MACCHINA_USER }}@$STAGING_HOST:$STAGING_DIR/$GITHUB_SHA/bin/macos/monterey/arm64 | |
release_source: | |
runs-on: ubuntu-22.04 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Archive | |
run: | | |
mkdir -p $RUNNER_TEMP/archives | |
version=`git describe --match 'v[0-9]*' | cut -b 2- -` | |
git archive --format=tar.gz --prefix=${ARCHIVE_PREFIX}/ --output=$RUNNER_TEMP/archives/${ARCHIVE_PREFIX}_$version.tar.gz ${GITHUB_REF_NAME} | |
git archive --format=zip --prefix=${ARCHIVE_PREFIX}/ --output=$RUNNER_TEMP/archives/${ARCHIVE_PREFIX}_$version.zip ${GITHUB_REF_NAME} | |
- | |
name: Install SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.MACCHINA_IO_SSH_HOST_KEY }}' >~/.ssh/known_hosts | |
echo '${{ secrets.MACCHINA_SSH_KEY }}' >~/.ssh/id_rsa | |
chmod go-rwx ~/.ssh/id_rsa | |
- | |
name: Copy to Web Server | |
run: | | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST mkdir -p $STAGING_DIR/$GITHUB_SHA/src | |
scp $RUNNER_TEMP/archives/* ${{ secrets.MACCHINA_USER }}@$STAGING_HOST:$STAGING_DIR/$GITHUB_SHA/src | |
sign_and_publish: | |
runs-on: ubuntu-22.04 | |
needs: ["release_win64", "release_ubuntu2004", "release_ubuntu2204", "release_raspberrypi", "release_macos12_x86_64", "release_macos12_arm64", "release_source"] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Install SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.MACCHINA_IO_SSH_HOST_KEY }}' >~/.ssh/known_hosts | |
echo '${{ secrets.MACCHINA_SSH_KEY }}' >~/.ssh/id_rsa | |
chmod go-rwx ~/.ssh/id_rsa | |
- | |
name: Sign and publish | |
run: | | |
version=`git describe --match 'v[0-9]*' | cut -b 2- -` | |
ssh ${{ secrets.MACCHINA_USER }}@$STAGING_HOST ./sign_and_publish.sh $version $STAGING_DIR/$GITHUB_SHA ${{ inputs.channel }} |