Skip to content

Update ci.yml

Update ci.yml #33

Workflow file for this run

name: CI (Linux/macOS)
on:
push:
branches: [ main ]
tags: ['v*']
release:
types: [published]
pull_request:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
qt_host: linux
qt_arch: linux_gcc_64
- os: macos-latest
arch: arm64
qt_host: mac
qt_arch: clang_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
# Prep
- name: Prep Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Prep macOS
if: startsWith(matrix.os, 'macos-')
run: |
brew update
brew install ninja || true
# Qt
- name: Install Qt 6.10.0
uses: jurplel/install-qt-action@v4
with:
version: '6.10.0'
host: ${{ matrix.qt_host }}
target: desktop
arch: ${{ matrix.qt_arch }}
cache: true
aqtversion: '==3.3.*'
modules: 'qthttpserver qtwebsockets'
- name: Show versions (Unix)
if: matrix.os != 'windows-latest'
run: |
cmake --version
qmake -v || true
# Configure
- name: Configure (Unix)
if: matrix.os != 'windows-latest'
run: cmake -S src -B build-Release -G Ninja -DCMAKE_BUILD_TYPE=Release
# Build
- name: Build (Unix)
if: matrix.os != 'windows-latest'
run: cmake --build build-Release --parallel
# Package
- name: CPack (Unix)
if: matrix.os != 'windows-latest'
run: cmake --build build-Release --target package --parallel
continue-on-error: true
# Artifacts
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.os }}-${{ matrix.arch }}-packages
path: |
build-Release/${{ github.event.repository.name }}-*.deb
build-Release/${{ github.event.repository.name }}-*.rpm
build-Release/${{ github.event.repository.name }}-*.sh
build-Release/${{ github.event.repository.name }}-*.run
build-Release/${{ github.event.repository.name }}-*.zip
build-Release/${{ github.event.repository.name }}-*.tar.gz
build-Release/${{ github.event.repository.name }}-*.dmg
if-no-files-found: error
release:
name: Publish GitHub Release
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ github.event.repository.name }}-*packages
merge-multiple: true
path: artifacts
- name: List files
run: ls -lah artifacts
- name: Create Release & upload assets
uses: softprops/action-gh-release@v2
with:
# Mark RC/Beta as prerelease automatically (optional)
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') }}
files: artifacts/*
- name: Prepare Range Cloud client key and certificate
run: |
set -euo pipefail
mkdir -p $HOME/.private_keys
echo "$RANGE_CLOUD_KEY_PEM" | base64 -d > $HOME/.private_keys/range_cloud_key.pem
chmod 600 $HOME/.private_keys/range_cloud_key.pem
echo "$RANGE_CLOUD_CERT_PEM" | base64 -d > $HOME/.private_keys/range_cloud_cert.pem
chmod 600 $HOME/.private_keys/range_cloud_cert.pem
env:
RANGE_CLOUD_KEY_PEM: ${{ secrets.RANGE_CLOUD_KEY_PEM }}
RANGE_CLOUD_CERT_PEM: ${{ secrets.RANGE_CLOUD_CERT_PEM }}
- name: Publish on Range Cloud
run: |
set -euo pipefail
for f in artifacts/*; do
[ -f "$f" ] || continue
fileName="$(basename $f)"
fileVersion=$(echo ${f#$REPO_NAME} | cut -d'-' -f2)
fileOs=$(echo ${f#$REPO_NAME} | cut -d'-' -f3)
fileArch=$(echo ${f#$REPO_NAME} | cut -d'-' -f4 | cut -d'.' -f1)
echo "Uploading: $fileName"
curl -X PUT --upload-file $f -o $HOME/response.json --key $HOME/.private_keys/range_cloud_key.pem --key-type PEM --pass 12345678 --cert $HOME/.private_keys/range_cloud_cert.pem https://range-software.com:4012/file-upload/?resource-name=$fileName
fileId=$(jq -r '.id' $HOME/response.json)
echo "Updating file version: $fileName : $fileVersion"
curl -X POST -d "$fileVersion" --key $HOME/.private_keys/range_cloud_key.pem --key-type PEM --pass 12345678 --cert $HOME/.private_keys/range_cloud_cert.pem https://range-software.com:4012/file-update-version/?resource-id=$fileId
echo "Updating file tags: $fileName : $REPO_NAME,$fileOs,$fileArch"
curl -X POST -d "$REPO_NAME,$fileOs,$fileArch" --key $HOME/.private_keys/range_cloud_key.pem --key-type PEM --pass 12345678 --cert $HOME/.private_keys/range_cloud_cert.pem https://range-software.com:4012/file-update-tags/?resource-id=$fileId
done
env:
RANGE_CLOUD_KEY_PASSWORD: ${{ secrets.RANGE_CLOUD_KEY_PASSWORD }}
REPO_NAME: ${{ github.event.repository.name }}