Skip to content

Commit

Permalink
first attempt at release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Oct 17, 2024
1 parent f4f642a commit 66290f9
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 0 deletions.
230 changes: 230 additions & 0 deletions .github/workflows/Release_tag_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
name: Upload release for tag stable

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:

PC_Application_Ubuntu:
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.bump_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev qt6-tools-dev qt6-base-dev libqt6charts6-dev libqt6svg6-dev libgl-dev
qtchooser -install qt6 $(which qmake6)
- name: Get app version
id: id_version
run: |
cd Software/LibreCAL-GUI
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreCAL-GUI.pro`
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreCAL-GUI.pro`
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreCAL-GUI.pro`
echo "app_version=v$fw_major.$fw_minor.$fw_patch" >> $GITHUB_OUTPUT
- name: Build application
run: |
cd Software/LibreCAL-GUI
export QT_SELECT=qt6
qmake LibreCAL-GUI.pro
make -j9
zip LibreCAL-GUI.zip LibreCAL-GUI
shell: bash

- name: Bump release page
id: bump_release
uses: actions/create-release@v1
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{env.LIBRECAL_VERSION}}
release_name: ${{env.LIBRECAL_VERSION}}
body: |
See [CHANGELOG](https://github.com/${{github.repository}}/blob/${{env.LIBRECAL_VERSION}}/CHANGELOG.md) for more information.
draft: false
prerelease: false

- name: 'Upload release asset'
uses: actions/upload-release-asset@v1
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.bump_release.outputs.upload_url }}
asset_path: ./Software/LibreCAL-GUI/LibreCAL-GUI.zip
asset_name: LibreCAL-GUI-Ubuntu-${{env.LIBRECAL_VERSION}}.zip
asset_content_type: application/tar+gzip


PC_Application_Windows:
needs: PC_Application_Ubuntu
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.2.0'
arch: 'win64_mingw81'
modules: 'qtcharts'

- name: Download libusb
run: |
curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z
7z x libusb.7z -r -olibusb
Xcopy /E /I /Y libusb\include ..\Qt\6.2.0\mingw81_64\include
Xcopy /E /I /Y libusb\MinGW64\static Software\LibreCAL-GUI
shell: cmd

- name: Get app version
id: id_version
shell: msys2 {0}
run: |
cd Software/LibreCAL-GUI
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreCAL-GUI.pro`
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreCAL-GUI.pro`
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreCAL-GUI.pro`
echo "app_version=v$fw_major.$fw_minor.$fw_patch" >> $GITHUB_OUTPUT
- name: Build application
run: |
cd Software/LibreCAL-GUI
qmake LibreCAL-GUI.pro
make -j9
shell: cmd

- name: Deploy application
run: |
cd Software/LibreCAL-GUI/release
del *.o *.cpp
windeployqt.exe .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\Qt6OpenGL.dll .
shell: cmd

- name: Zip app
shell: cmd
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
run: |
7z a LibreCAL-GUI_Windows-${{env.LIBRECAL_VERSION}}.zip ./Software/LibreCAL-GUI/release
- name: 'Upload release asset'
uses: actions/upload-release-asset@v1
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.PC_Application_Ubuntu.outputs.upload_url }}
asset_path: ./LibreCAL-GUI_Windows-${{env.LIBRECAL_VERSION}}.zip
asset_name: LibreCAL-GUI_Windows-${{env.LIBRECAL_VERSION}}.zip
asset_content_type: application/tar+gzip

PC_Application_OSX:
needs: PC_Application_Ubuntu
runs-on: macos-12
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
brew install qt@6 libusb pcre
- name: Set Environment
run: |
echo "/usr/local/opt/qt@6/bin" >> $GITHUB_PATH
- name: Get app version
id: id_version
run: |
cd Software/LibreCAL-GUI
fw_major=`pcregrep -o '(?<=FW_MAJOR=)[0-9]+' LibreCAL-GUI.pro`
fw_minor=`pcregrep -o '(?<=FW_MINOR=)[0-9]+' LibreCAL-GUI.pro`
fw_patch=`pcregrep -o '(?<=FW_PATCH=)[0-9]+' LibreCAL-GUI.pro`
echo "app_version=v$fw_major.$fw_minor.$fw_patch" >> $GITHUB_OUTPUT
- name: Build application
run: |
cd Software/LibreCAL-GUI
qmake LibreCAL-GUI.pro
make -j9
macdeployqt LibreCAL-GUI.app
zip -ry LibreCAL-GUI.zip LibreCAL-GUI.app
shell: bash

- name: 'Upload release asset'
uses: actions/upload-release-asset@v1
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.PC_Application_Ubuntu.outputs.upload_url }}
asset_path: ./Software/LibreCAL-GUI/LibreCAL-GUI.zip
asset_name: LibreCAL-GUI-OSX-${{env.LIBRECAL_VERSION}}.zip
asset_content_type: application/tar+gzip

Embedded_Firmware:
needs: PC_Application_Ubuntu
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Install toolchain
run: |
sudo apt-get update
sudo apt install -y build-essential gcc-arm-none-eabi binutils-arm-none-eabi
sudo git clone https://github.com/raspberrypi/pico-sdk.git /opt/pico-sdk
sudo git -C /opt/pico-sdk checkout 2.0.0
sudo git -C /opt/pico-sdk submodule update --init
echo 'export PICO_SDK_PATH=/opt/pico-sdk' | sudo tee -a /etc/profile.d/pico-sdk.sh
source /etc/profile
- name: Get app version
id: id_version
run: |
cd Software/LibreCAL
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' CMakeLists.txt`
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' CMakeLists.txt`
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' CMakeLists.txt`
echo "app_version=v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build application
run: |
export PICO_SDK_PATH=/opt/pico-sdk
cd Software/LibreCAL
mkdir build && cd build
cmake ..
make -j9
make -j9
cp build/LibreCAL.uf2 ../../
shell: bash

- name: Zip firmware
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
run: |
zip EmbeddedFirmware-${{env.LIBRECAL_VERSION}}.zip LibreCAL.uf2
shell: bash

- name: 'Upload release asset'
uses: actions/upload-release-asset@v1
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.PC_Application_Ubuntu.outputs.upload_url }}
asset_path: ./EmbeddedFirmware-${{env.LIBRECAL_VERSION}}.zip
asset_name: EmbeddedFirmware-${{env.LIBRECAL_VERSION}}.zip
asset_content_type: application/tar+gzip
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v0.2.1

First public release

0 comments on commit 66290f9

Please sign in to comment.