-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (132 loc) · 5.55 KB
/
Copy pathci.yml
File metadata and controls
150 lines (132 loc) · 5.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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
qt_version: '6.11.1'
- os: macos-latest
arch: arm64
qt_host: mac
qt_arch: clang_64
qt_version: '6.11.1'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
# Prep
- name: Prep Linux
if: startsWith(matrix.os, 'ubuntu-')
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
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
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 --target package --parallel
# 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 }}-*.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)"
fileInfo=${fileName#$REPO_NAME}
fileVersion=$(echo $fileInfo | cut -d'-' -f2)
fileOs=$(echo $fileInfo | cut -d'-' -f3)
fileArch=$(echo $fileInfo | 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 "$RANGE_CLOUD_KEY_PASSWORD" --cert $HOME/.private_keys/range_cloud_cert.pem https://range-software.com:4012/file-replace/?resource-name=$fileName
fileId=$(jq -r '.upload.id' $HOME/response.json)
echo "Updating file access mode: $fileName : 644"
curl -X POST -d "{\"user\":6,\"group\":4,\"other\":4}" --key $HOME/.private_keys/range_cloud_key.pem --key-type PEM --pass "$RANGE_CLOUD_KEY_PASSWORD" --cert $HOME/.private_keys/range_cloud_cert.pem https://range-software.com:4012/file-update-access-mode/?resource-id=$fileId
echo "Updating file version: $fileName : $fileVersion"
curl -X POST -d "$fileVersion" --key $HOME/.private_keys/range_cloud_key.pem --key-type PEM --pass "$RANGE_CLOUD_KEY_PASSWORD" --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 "$RANGE_CLOUD_KEY_PASSWORD" --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 }}