Update main.yml #47
This file contains 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: Release_Version | |
on: | |
push: | |
branches: [ main ] | |
# somehow I need to find way to addsteps | |
# pull_request: | |
# branches: [ master ] | |
# tags: | |
# - "v*" | |
jobs: | |
create_release: | |
name: Create release | |
runs-on: ubuntu-20.04 | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: get app version | |
run: | | |
# echo "::set-output name=VER_TAG_NAME::$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" | |
echo "VER_TAG_NAME=$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT | |
echo "::set-output name=APP_NAME::$(cat *.pro |grep 'TARGET ='|awk -F\= '{print $2;}'| tr -d ' ')" | |
id: build | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.build.outputs.VER_TAG_NAME }}_${{ github.ref }} | |
release_name: Release CI ${{ steps.build.outputs.VER_TAG_NAME }} ${{ github.ref }} | |
build_release: | |
name: Build release | |
needs: create_release | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- os: ubuntu-20.04 | |
- os: macos-latest | |
- os: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: get app version | |
if: matrix.config.os == 'ubuntu-20.04' | |
run: | | |
#echo "::set-output name=VER_TAG_NAME::$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" | |
echo "VER_TAG_NAME=$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT | |
echo "::set-output name=APP_NAME::$(cat *.pro |grep 'TARGET ='|awk -F\= '{print $2;}'| tr -d ' ')" | |
id: build | |
- name: add qt repo to linux | |
if: matrix.config.os == 'ubuntu-20.04' | |
run: | | |
sudo add-apt-repository ppa:beineri/opt-qt-5.15.4-focal -y | |
sudo apt-get update -qq | |
- name: install qt into linux | |
if: matrix.config.os == 'ubuntu-20.04' | |
run: sudo apt-get -y install debhelper qt515base qt515tools libgl1-mesa-dev qt515charts-no-lgpl qt515serialport | |
#- name: install deb deps into the same linux | |
# if: matrix.config.os == 'ubuntu-20.04' | |
# run: apt-get -y install debhelper | |
- name: build on linux | |
if: matrix.config.os == 'ubuntu-20.04' | |
run: | | |
source /opt/qt*/bin/qt*-env.sh || true | |
dpkg-buildpackage -us -uc | |
#echo "::set-output name=VER_TAG_NAME::$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" | |
echo "VER_TAG_NAME=$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT | |
echo "::set-output name=APP_NAME::$(cat *.pro |grep 'TARGET ='|awk -F\= '{print $2;}'| tr -d ' ')" | |
qmake CONFIG+=release PREFIX=/usr | |
make -j$(nproc) | |
lrelease $(ls *.pro) | |
mkdir -p appdir/usr/bin | |
ls -lR | |
cp translations/*.qm appdir/usr/bin/ | |
cp ${{ steps.build.outputs.APP_NAME }} appdir/usr/bin/${{ steps.build.outputs.APP_NAME }} | |
mkdir -p appdir/usr/share/icons/ | |
cp images/qtrfpowermeter.png appdir/usr/share/icons/ | |
mkdir -p appdir/usr/share/applications/ | |
cp ${{ steps.build.outputs.APP_NAME }}.desktop appdir/usr/share/applications/ | |
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" | |
chmod a+x linuxdeployqt-continuous-x86_64.AppImage | |
./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage | |
ls -l | |
cp ./qtrfpowermeter*.AppImage ./qtrfpowermeter.AppImage | |
ls -l | |
# - name: buil deb in the same os | |
# if: matrix.config.os == 'ubuntu-20.04' | |
# run: | | |
# ls -l | |
# make clean | |
# dpkg-buildpackage -us -uc | |
# ls -l | |
# ls -l ../ | |
- name: Upload Release Asset Linux AppImage | |
if: matrix.config.os == 'ubuntu-20.04' | |
id: upload-release-asset-linux-appimage | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./qtrfpowermeter.AppImage | |
asset_name: qtrfpowermeter-x86_64.AppImage | |
asset_content_type: application/octet-stream | |
- name: Upload deb to release | |
if: matrix.config.os == 'ubuntu-20.04' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
run: | | |
ls -l | |
ls -l ../ | |
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ../*.deb | |
# asset_name: qtrfpowermeter-x86_64.AppImage | |
asset_content_type: application/octet-stream | |
- name: get app version | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
#echo "::set-output name=VER_TAG_NAME::$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')" | |
echo "VER_TAG_NAME=$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')" >> $GITHUB_OUTPUT | |
echo "::set-output name=APP_NAME::$(cat *.pro |grep 'TARGET ='|awk -F\= '{print $2;}'| tr -d ' ')" | |
id: buildosx | |
- name: install qt OSX | |
if: matrix.config.os == 'macos-latest' | |
run: brew install qt5 | |
- name: buid OSX | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
chmod 777 MAC_build_RELEASE.sh | |
./MAC_build_RELEASE.sh | |
ls -l | |
- name: Upload Release Asset dmg | |
if: matrix.config.os == 'macos-latest' | |
id: upload-release-asset-dmg | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./${{ steps.buildosx.outputs.APP_NAME }}_${{ steps.buildosx.outputs.VER_TAG_NAME }}.dmg | |
asset_name: ${{ steps.buildosx.outputs.APP_NAME }}_${{ steps.buildosx.outputs.VER_TAG_NAME }}.dmg | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset zip | |
if: matrix.config.os == 'macos-latest' | |
id: upload-release-asset-zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./${{ steps.buildosx.outputs.APP_NAME }}_${{ steps.buildosx.outputs.VER_TAG_NAME }}.zip | |
asset_name: ${{ steps.buildosx.outputs.APP_NAME }}_${{ steps.buildosx.outputs.VER_TAG_NAME }}.zip | |
asset_content_type: application/zip | |
- name: Setup MSYS2 env | |
if: matrix.config.os == 'windows-latest' | |
uses: msys2/setup-msys2@v2 | |
with: | |
# Variant of the environment to set by default: MSYS, MINGW32 or MINGW64 | |
msystem: MSYS | |
# Default value for MSYS2_PATH_TYPE environment variable: strict, inherit or minimal | |
#path-type: # optional, default is minimal | |
# Retrieve and extract base installation from upstream GitHub Releases | |
#release: # optional, default is true | |
# Update MSYS2 installation through pacman | |
#update: # optional | |
# Install packages after installation through pacman | |
install: >- | |
mingw-w64-x86_64-toolchain | |
base-devel | |
git | |
p7zip | |
ruby | |
mingw-w64-x86_64-qt5 | |
mingw-w64-i686-toolchain | |
mingw-w64-i686-qwt-qt5 | |
mingw-w64-x86_64-zlib | |
mingw-w64-i686-zlib | |
zlib-devel | |
mingw-w64-x86_64-openssl | |
mingw-w64-i686-openssl | |
openssl-devel | |
shell: msys2 {0} | |
- name: get app version | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
#echo "::set-output name=VER_TAG_NAME::$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" | |
echo "VER_TAG_NAME=$(cat main.cpp |grep 'const QString APP'|awk -F\" '{print $2;}')-$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT | |
echo "::set-output name=APP_NAME::$(cat *.pro |grep 'TARGET ='|awk -F\= '{print $2;}'| tr -d ' ')" | |
shell: msys2 {0} | |
id: buildwin | |
- name: make 64 win app | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
ls -l | |
pwd | |
set MSYSTEM=MINGW64 | |
ROOTMSYS=/d/a/_temp/msys64/mingw64 | |
export PATH=$ROOTMSYS/bin:$PATH | |
qmake | |
make | |
rm -f release/*.o; rm -f release/*.cpp; rm -f release/*.h | |
windeployqt.exe --no-translations release/${{ steps.buildwin.outputs.APP_NAME }}.exe | |
ls -l $ROOTMSYS/bin | |
cp $ROOTMSYS/bin/zlib*.dll release/; cp $ROOTMSYS/bin/libgcc*.dll release/; cp $ROOTMSYS/bin/libwinpthread*.dll release/; cp $ROOTMSYS/bin/libstdc*.dll release/; cp $ROOTMSYS/bin/libdouble*.dll release/; cp $ROOTMSYS/bin/libicuin*.dll release/; cp $ROOTMSYS/bin/libicuuc*.dll release/; cp $ROOTMSYS/bin/libicudt*.dll release/; cp $ROOTMSYS/bin/libpcre*.dll release/; cp $ROOTMSYS/bin/libzstd*.dll release/; cp $ROOTMSYS/bin/libharfbuzz*.dll release/; cp $ROOTMSYS/bin/libgraphite*.dll release/; cp $ROOTMSYS/bin/libfreetype*.dll release/; cp $ROOTMSYS/bin/libbrotlidec*.dll release/; cp $ROOTMSYS/bin/libbrotlicommon*.dll release/; cp $ROOTMSYS/bin/libbz*.dll release/; cp $ROOTMSYS/bin/libpng*.dll release/; cp $ROOTMSYS/bin/libglib*.dll release/; cp $ROOTMSYS/bin/libintl*.dll release/; cp $ROOTMSYS/bin/libiconv*.dll release/; cp $ROOTMSYS/bin/libpcre*.dll release/ | |
cp $ROOTMSYS/bin/libcrypto*.dll release/; cp $ROOTMSYS/bin/libssl*.dll release/; cp $ROOTMSYS/bin/libmd4c.dll release/ | |
mv release ${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN64; 7z -tzip a ${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN64.zip ./${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN64/ | |
make clean | |
ls -l | |
shell: msys2 {0} | |
# mingw32 dropping 32bit support. so install it now a bit headache looks like no more builds for 32bit | |
# - name: make 32 win app | |
# if: matrix.config.os == 'windows-latest' | |
# run: | | |
# set MSYSTEM=MINGW32 | |
# ROOTMSYS=/d/a/_temp/msys64/mingw32 | |
# export PATH=$ROOTMSYS/bin:$PATH | |
# qmake | |
# make | |
# rm -f release/*.o; rm -f release/*.cpp; rm -f release/*.h; | |
# windeployqt.exe --no-translations release/${{ steps.buildwin.outputs.APP_NAME }}.exe | |
# cp $ROOTMSYS/bin/zlib*.dll release/; cp $ROOTMSYS/bin/libgcc*.dll release/; cp $ROOTMSYS/bin/libwinpthread*.dll release/; cp $ROOTMSYS/bin/libstdc*.dll release/; cp $ROOTMSYS/bin/libdouble*.dll release/; cp $ROOTMSYS/bin/libicuin*.dll release/; cp $ROOTMSYS/bin/libicuuc*.dll release/; cp $ROOTMSYS/bin/libicudt*.dll release/; cp $ROOTMSYS/bin/libpcre*.dll release/; cp $ROOTMSYS/bin/libzstd*.dll release/; cp $ROOTMSYS/bin/libharfbuzz*.dll release/; cp $ROOTMSYS/bin/libgraphite*.dll release/; cp $ROOTMSYS/bin/libfreetype*.dll release/; cp $ROOTMSYS/bin/libbrotlidec*.dll release/; cp $ROOTMSYS/bin/libbrotlicommon*.dll release/; cp $ROOTMSYS/bin/libbz*.dll release/; cp $ROOTMSYS/bin/libpng*.dll release/; cp $ROOTMSYS/bin/libglib*.dll release/; cp $ROOTMSYS/bin/libintl*.dll release/; cp $ROOTMSYS/bin/libiconv*.dll release/; cp $ROOTMSYS/bin/libpcre*.dll release/; | |
# cp $ROOTMSYS/bin/libcrypto*.dll release/; cp $ROOTMSYS/bin/libssl*.dll release/; cp $ROOTMSYS/bin/libmd4c.dll release/ | |
# mv release ${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN32; 7z -tzip a ${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN32.zip ./${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN32/ | |
# shell: msys2 {0} | |
- name: Upload Release Asset Win64 | |
if: matrix.config.os == 'windows-latest' | |
id: upload-release-asset-win64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN64.zip | |
asset_name: ${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN64.zip | |
asset_content_type: application/zip | |
# - name: Upload Release Asset Win32 | |
# if: matrix.config.os == 'windows-latest' | |
# id: upload-release-asset-win32 | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
# asset_path: ./${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN32.zip | |
# asset_name: ${{ steps.buildwin.outputs.APP_NAME }}_${{ steps.buildwin.outputs.VER_TAG_NAME }}_WIN32.zip | |
# asset_content_type: application/zip | |