Bump to v2.2.2 #72
This file contains hidden or 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: Build and Release | |
on: | |
push: | |
tags: [ "v*" ] | |
branches: | |
- main | |
- dev | |
- feat/** | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [windows, linux] | |
variant: [normal, avalon] | |
env: | |
BUILD_FOR_AVALON_NANO3: ${{ matrix.variant == 'avalon' && 'ON' || 'OFF' }} | |
TARGET_SUFFIX: ${{ matrix.variant == 'avalon' && 'Avalon' || 'Normal' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Get Git revision | |
id: revision | |
run: | | |
revision=$(git describe --long --tag --dirty --always) | |
echo "REVISION=$revision" >> $GITHUB_ENV | |
- name: Build project | |
run: | | |
rm -rf ${{ github.workspace }}/build && mkdir -p ${{ github.workspace }}/build | |
if [[ "${{ matrix.os }}" == "windows" ]]; then | |
docker run --name qt6 -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.7-mingw-aqt /bin/bash -c ' | |
export CI=1 | |
qt-cmake ./project -G Ninja -B ./build -DTARGET_AVALON_NANO3=${{ env.BUILD_FOR_AVALON_NANO3 }} | |
cmake --build ./build | |
cmake --install ./build | |
ls -alh ./build | |
' | |
docker cp qt6:/home/user/build/dist ${{ github.workspace }}/build/ | |
docker rm qt6 | |
ls -alh ${{ github.workspace }}/build/ | |
ls -alh ${{ github.workspace }}/build/dist | |
ls -alh ${{ github.workspace }}/build/dist/bin | |
# cd ${{ github.workspace }}/build/dist/bin | |
# if [[ "${{ matrix.variant }}" == "avalon" ]]; then | |
# zip -r "${{ github.workspace }}/build/K230BurningTool-Windows-avalon-${{ env.REVISION }}.zip" . | |
# else | |
# zip -r "${{ github.workspace }}/build/K230BurningTool-Windows-${{ env.REVISION }}.zip" . | |
# fi | |
else | |
docker run --name qt6 --privileged -v /dev/fuse:/dev/fuse -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.6-gcc-aqt /bin/bash -c ' | |
export CI=1 | |
sudo apt update | |
sudo apt install -y libgl-dev libvulkan-dev libssl-dev libudev-dev fuse file | |
sudo curl -L https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage -o /usr/bin/linuxdeployqt | |
sudo chmod +x /usr/bin/linuxdeployqt | |
qt-cmake ./project -G Ninja -B ./build -DTARGET_AVALON_NANO3=${{ env.BUILD_FOR_AVALON_NANO3 }} | |
cmake --build ./build | |
cmake --install ./build | |
ls -alh ./build | |
' | |
docker cp qt6:/home/user/build ${{ github.workspace }}/build/ | |
docker rm qt6 | |
cd ${{ github.workspace }}/build/build | |
if [[ "${{ matrix.variant }}" == "avalon" ]]; then | |
mv K230BurningTool-x86_64.AppImage K230BurningTool-${{ env.REVISION }}-x86_64.AppImage | |
fi | |
fi | |
- name: Prepare artifacts | |
shell: bash | |
run: | | |
# Create output directory | |
mkdir -p ${{ github.workspace }}/artifact_output | |
if [ "${{ matrix.os }}" = "windows" ]; then | |
if [ -d "${{ github.workspace }}/build/dist/bin" ]; then | |
cp -r ${{ github.workspace }}/build/dist/bin ${{ github.workspace }}/artifact_output/ | |
fi | |
fi | |
# For Linux: Copy AppImage if it exists | |
if [ "${{ matrix.os }}" = "linux" ]; then | |
if ls ${{ github.workspace }}/build/build/K230BurningTool-*.AppImage 1> /dev/null 2>&1; then | |
cp ${{ github.workspace }}/build/build/K230BurningTool-*.AppImage ${{ github.workspace }}/artifact_output/ | |
fi | |
fi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: K230BurningTool-${{ matrix.os }}-${{ matrix.variant }}-${{ env.REVISION }} | |
path: ${{ github.workspace }}/artifact_output/* | |
if-no-files-found: error | |
compression-level: 9 | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# with: | |
# token: ${{ secrets.GIT_TOKEN }} | |
- name: Generate Version Info | |
run: | | |
TAG_NAME="${GITHUB_REF##*/}" | |
VERSION_STR="${TAG_NAME#v}" | |
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_STR" | |
VERSION_VALUE=$((MAJOR * 1000 + MINOR * 100 + PATCH)) | |
HASH_VALUE="$(git rev-parse HEAD)" | |
echo "{\"version\": $VERSION_VALUE, \"hash\": \"$HASH_VALUE\"}" > k230_burningtool_lastest.txt | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ./release | |
- name: List artifacts | |
run: ls -R ./release | |
- name: Package artifacts for release | |
shell: bash | |
run: | | |
# Create release directory | |
mkdir -p ./release_packages | |
# Package Linux AppImages | |
for dir in ./release/K230BurningTool-linux-*/; do | |
base=$(basename "$dir") | |
if [ -f "$dir"/*.AppImage ]; then | |
cp "$dir"/*.AppImage "./release_packages/$base.AppImage" | |
fi | |
done | |
# Package Windows binaries | |
for dir in ./release/K230BurningTool-windows-*/; do | |
base=$(basename "$dir") | |
if [ -d "$dir/bin" ]; then | |
(cd "$dir" && zip -r "../../release_packages/$base.zip" bin/) | |
fi | |
done | |
- name: Upload GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
tag_name: ${{ github.ref_name }} | |
files: | | |
k230_burningtool_lastest.txt | |
./release_packages/*.AppImage | |
./release_packages/*.zip |