-
-
Notifications
You must be signed in to change notification settings - Fork 61
165 lines (149 loc) · 6.52 KB
/
release.yml
File metadata and controls
165 lines (149 loc) · 6.52 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: ipctool-release
on:
push:
branches:
- master
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: arm32
# OpenIPC's Hi3516CV100 toolchain — the canonical 32-bit ARM
# musleabi static build used for all V1..V5 HiSilicon and the
# rest of the 32-bit-ARM camera world.
toolchain_url: https://github.com/OpenIPC/firmware/releases/download/toolchain/toolchain.hisilicon-hi3516cv100.tgz
toolchain_dir: arm-openipc-linux-musleabi_sdk-buildroot
cc: arm-openipc-linux-musleabi-gcc
asset_suffix: ""
publish_s3: true
- target: mips32
toolchain_url: https://github.com/OpenIPC/firmware/releases/download/toolchain/toolchain.ingenic-t31.tgz
toolchain_dir: mipsel-openipc-linux-musl_sdk-buildroot
cc: mipsel-openipc-linux-musl-gcc
asset_suffix: "-mips32"
publish_s3: false
- target: arm64
# Bootlin's prebuilt aarch64 musl cross toolchain. Switch
# to an OpenIPC-hosted tarball once one is published.
toolchain_url: https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--musl--stable-2025.08-1.tar.xz
toolchain_dir: aarch64--musl--stable-2025.08-1
cc: aarch64-buildroot-linux-musl-gcc
asset_suffix: "-arm64"
publish_s3: false
env:
UPX_VERSION: 4.2.3
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute release vars
run: |
HEAD_TAG=$(git tag --points-at HEAD)
GIT_HASH=$(git rev-parse --short $GITHUB_SHA)
BRANCH_NAME=$(echo $GITHUB_REF | cut -d'/' -f 3)
if [ -z "$HEAD_TAG" ]; then
TAG_NAME="latest"
RELEASE_NAME="Development Build"
PRERELEASE=true
else
TAG_NAME=${GITHUB_REF}
RELEASE_NAME="Release ${GITHUB_REF}"
PRERELEASE=false
fi
echo "HEAD_TAG=$HEAD_TAG" >> $GITHUB_ENV
echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
- name: Fetch toolchain
run: |
# Download to file (with retries) before extracting — piping
# wget -> tar makes transient stream truncations look like
# corrupt archives; the wget retry only helps with discrete
# files.
wget --tries=3 --timeout=60 -O /tmp/toolchain.tar "${{ matrix.toolchain_url }}"
# `tar xf` autodetects gzip/bzip2/xz so the matrix entries
# can mix archive formats freely.
tar xf /tmp/toolchain.tar -C /opt
rm /tmp/toolchain.tar
- name: Build sources
id: build
run: |
wget -q https://github.com/upx/upx/releases/download/v$UPX_VERSION/upx-$UPX_VERSION-amd64_linux.tar.xz
tar -xf upx-$UPX_VERSION-amd64_linux.tar.xz --strip-components 1
export PATH=/opt/${{ matrix.toolchain_dir }}/bin:$PATH
sudo apt-get install -y cmake
cmake -H. -Bbuild -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_BUILD_TYPE=Release
cmake --build build
./upx build/ipcinfo
./upx build/ipctool
cp build/ipctool ipctool-$GIT_HASH
continue-on-error: true
- name: Send warning to Telegram on build failure
env:
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }}
TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }}
if: steps.build.outcome != 'success'
run: |
TG_OPTIONS="-s --connect-timeout 5 --max-time 15"
TG_NOTIFY="Warning, ipctool-${{ matrix.target }} build error..."
TG_HEADER=$(echo -e "\r\n$TG_NOTIFY \r\n\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9A\xA0 GitHub Actions")
curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendMessage \
-F chat_id=$TG_CHANNEL -F text="$TG_HEADER"
- name: Create release
if: steps.build.outcome == 'success'
uses: actions/create-release@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: ${{ env.PRERELEASE }}
- name: Upload ipctool to release
if: steps.build.outcome == 'success'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/ipctool
asset_name: ipctool${{ matrix.asset_suffix }}
tag: ${{ env.TAG_NAME }}
overwrite: true
- name: Upload ipcinfo to release
if: steps.build.outcome == 'success'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/ipcinfo
asset_name: ipcinfo${{ matrix.asset_suffix }}
tag: ${{ env.TAG_NAME }}
overwrite: true
- name: Publish dev build on S3
if: matrix.publish_s3 && steps.build.outcome == 'success' && env.HEAD_TAG == ''
uses: tpaschalis/s3-sync-action@master
with:
args: --acl public-read
env:
FILE: ./ipctool-${{ env.GIT_HASH }}
AWS_REGION: 'eu-north-1'
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Send binary to Telegram
if: steps.build.outcome == 'success'
env:
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }}
TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }}
run: |
TG_OPTIONS="-s --connect-timeout 5 --max-time 15"
TG_HEADER=$(echo -e "\r\nTarget: ${{ matrix.target }} \r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9C\x85 GitHub Actions")
curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendDocument \
-F chat_id=$TG_CHANNEL -F document="@build/ipctool" -F caption="$TG_HEADER"