|
| 1 | +name: Automatic build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + release: |
| 8 | + types: [ created ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + Linux: |
| 12 | + if: github.event_name == 'push' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v1 |
| 16 | + with: |
| 17 | + fetch-depth: 1 |
| 18 | + - name: Install dependencies |
| 19 | + run: | |
| 20 | + sudo apt update |
| 21 | + sudo apt install libxss1 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 qt5-default libqt5gui5 libqt5webengine5 libqt5webenginecore5 libqt5webenginewidgets5 libqt5printsupport5 libqt5quickwidgets5 qml-module-qtquick-controls libqt5x11extras5 binutils cmake pkg-config qtbase5-dev qtwebengine5-dev libqt5x11extras5-dev qtbase5-private-dev libssl-dev libxss-dev libxmu-dev |
| 22 | + - name: Configure |
| 23 | + run: qmake . |
| 24 | + - name: Build |
| 25 | + run: make -j2 |
| 26 | + |
| 27 | + Flatpak: |
| 28 | + if: github.event_name == 'release' |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v1 |
| 32 | + with: |
| 33 | + fetch-depth: 1 |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + sudo apt update |
| 37 | + sudo apt install flatpak flatpak-builder |
| 38 | + - name: Install Flatpak KDE SDK |
| 39 | + run: | |
| 40 | + sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo |
| 41 | + sudo flatpak install --system -y flathub org.kde.Platform//5.14 |
| 42 | + sudo flatpak install --system -y flathub org.kde.Sdk//5.14 |
| 43 | + - name: Build the Flatpak package |
| 44 | + run: | |
| 45 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 46 | + pushd dist/flatpak |
| 47 | + sudo flatpak-builder --repo=flatpak-repo --force-clean flatpak-build org.fedoraproject.MediaWriter.json |
| 48 | + flatpak build-bundle flatpak-repo org.fedoraproject.MediaWriter.flatpak org.fedoraproject.MediaWriter |
| 49 | + mv org.fedoraproject.MediaWriter.flatpak ../../org.fedoraproject.MediaWriter-$TAG_NAME.flatpak |
| 50 | + popd |
| 51 | + - name: Upload to GitHub |
| 52 | + if: github.event_name == 'release' |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 56 | + bash ./dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="org.fedoraproject.MediaWriter-$TAG_NAME.flatpak" |
| 57 | +
|
| 58 | + macOS: |
| 59 | + runs-on: macos-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v1 |
| 62 | + with: |
| 63 | + fetch-depth: 1 |
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + brew install qt |
| 67 | + echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile |
| 68 | + brew install xz |
| 69 | + brew install git |
| 70 | + npm install -g create-dmg |
| 71 | + - name: Configure |
| 72 | + run: | |
| 73 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 74 | + bash dist/mac/build.sh configure |
| 75 | + - name: Build |
| 76 | + run: | |
| 77 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 78 | + bash dist/mac/build.sh build |
| 79 | + - name: Insert dependencies |
| 80 | + if: github.event_name == 'release' |
| 81 | + run: | |
| 82 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 83 | + bash dist/mac/build.sh deps |
| 84 | + - name: Sign (TBD) |
| 85 | + if: github.event_name == 'release' |
| 86 | + run: | |
| 87 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 88 | + true # bash dist/mac/build.sh sign |
| 89 | + - name: Package |
| 90 | + if: github.event_name == 'release' |
| 91 | + run: | |
| 92 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 93 | + cd build/app |
| 94 | + create-dmg "Fedora Media Writer.app" || true # without signing, create-dmg returns an error code |
| 95 | + mv Fedora*.dmg ../../FedoraMediaWriter-osx-$TAG_NAME.unnotarized.dmg |
| 96 | + - name: Notarize (TBD) |
| 97 | + if: github.event_name == 'release' |
| 98 | + run: | |
| 99 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 100 | + true # bash dist/mac/build.sh notarize |
| 101 | + - name: Upload to GitHub |
| 102 | + if: github.event_name == 'release' |
| 103 | + shell: bash |
| 104 | + run: | |
| 105 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 106 | + bash ./dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="FedoraMediaWriter-osx-$TAG_NAME.unnotarized.dmg" |
| 107 | +
|
| 108 | + Windows: |
| 109 | + runs-on: windows-latest |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@v1 |
| 112 | + with: |
| 113 | + fetch-depth: 1 |
| 114 | + - name: Cache Qt |
| 115 | + id: cache-qt |
| 116 | + uses: actions/cache@v1 |
| 117 | + with: |
| 118 | + path: d:/a/MediaWriter/Qt |
| 119 | + key: QtCache |
| 120 | + - name: Install dependencies |
| 121 | + shell: bash |
| 122 | + run: | |
| 123 | + choco install nsis |
| 124 | + choco install dos2unix |
| 125 | + - name: Install Qt |
| 126 | + uses: jurplel/install-qt-action@v2 |
| 127 | + with: |
| 128 | + cached: ${{ steps.cache-qt.outputs.cache-hit }} |
| 129 | + arch: win64_mingw73 |
| 130 | + - name: Build xz-utils |
| 131 | + shell: bash |
| 132 | + if: ${{ !steps.cache-qt.outputs.cache-hit }} |
| 133 | + run: | |
| 134 | + git clone https://git.tukaani.org/xz.git |
| 135 | + sed -i 's/#include "config.h"//' xz/src/common/common_w32res.rc |
| 136 | + sed -i 's/PACKAGE_NAME/"liblzma"/' xz/src/common/common_w32res.rc |
| 137 | + sed -i 's/PACKAGE_URL/"https:\/\/tukaani.org\/xz\/"/' xz/src/common/common_w32res.rc |
| 138 | + mkdir xz/build |
| 139 | + cd xz/build |
| 140 | + cmake -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="$Qt5_Dir" -DBUILD_SHARED_LIBS=ON .. |
| 141 | + mingw32-make -j2 VERBOSE=1 |
| 142 | + mingw32-make install |
| 143 | + # ugh |
| 144 | + cp "$Qt5_Dir/bin/liblzma.dll" "$Qt5_Dir/bin/libliblzma.dll" |
| 145 | + - name: Build MediaWriter |
| 146 | + shell: bash |
| 147 | + run: | |
| 148 | + #export PATH=$(echo "$PATH" | sed -e 's/:\/c\/ProgramData\/Chocolatey\/bin//' | sed -e 's/:\/c\/Strawberry\/c\/bin//') |
| 149 | + #export PATH="$Qt5_Dir/../../Tools/mingw730_32/bin:$PATH" |
| 150 | + mkdir build |
| 151 | + cd build |
| 152 | + "$Qt5_Dir/bin/qmake" .. |
| 153 | + mingw32-make -j2 VERBOSE=1 |
| 154 | + - name: Windeployqt |
| 155 | + if: github.event_name == 'release' |
| 156 | + shell: bash |
| 157 | + run: | |
| 158 | + cd build/app/release |
| 159 | + mv ../helper.exe . |
| 160 | + $Qt5_Dir/bin/windeployqt -qmldir ../../.. mediawriter.exe |
| 161 | + cp $Qt5_Dir/bin/libstdc*.dll . |
| 162 | + cp $Qt5_Dir/bin/libwinpthread*.dll . |
| 163 | + cp $Qt5_Dir/bin/libgcc*.dll . |
| 164 | + cp /c/Program\ Files/OpenSSL/bin/*.dll . |
| 165 | + - name: Installer |
| 166 | + if: github.event_name == 'release' |
| 167 | + shell: bash |
| 168 | + run: | |
| 169 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 170 | +
|
| 171 | + VERSION_STRIPPED=$(sed "s/-.*//" <<< "${TAG_NAME}") |
| 172 | + if [[ "$VERSION_STRIPPED" == "" ]]; then |
| 173 | + VERSION_STRIPPED=0.0.0 |
| 174 | + fi |
| 175 | + VERSION_MAJOR=$(cut -d. -f1 <<< "${VERSION_STRIPPED}") |
| 176 | + VERSION_MINOR=$(cut -d. -f2 <<< "${VERSION_STRIPPED}") |
| 177 | + VERSION_BUILD=$(cut -d. -f3 <<< "${VERSION_STRIPPED}") |
| 178 | + INSTALLED_SIZE=$(du -k -d0 "build/app/release" | cut -f1) |
| 179 | +
|
| 180 | + cp "dist/win/mediawriter_native.nsi" "dist/win/mediawriter_native.tmp.nsi" |
| 181 | +
|
| 182 | + sed -i "s/#!define VERSIONMAJOR/!define VERSIONMAJOR ${VERSION_MAJOR}/" "dist/win/mediawriter_native.tmp.nsi" |
| 183 | + sed -i "s/#!define VERSIONMINOR/!define VERSIONMINOR ${VERSION_MINOR}/" "dist/win/mediawriter_native.tmp.nsi" |
| 184 | + sed -i "s/#!define VERSIONBUILD/!define VERSIONBUILD ${VERSION_BUILD}/" "dist/win/mediawriter_native.tmp.nsi" |
| 185 | + sed -i "s/#!define INSTALLSIZE/!define INSTALLSIZE ${INSTALLED_SIZE}/" "dist/win/mediawriter_native.tmp.nsi" |
| 186 | +
|
| 187 | + unix2dos < "LICENSE" > "build/app/release/LICENSE.txt" |
| 188 | + makensis -DCERTPATH="" -DCERTPASS="" dist/win/mediawriter_native.tmp.nsi |
| 189 | + mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64-$TAG_NAME.exe" |
| 190 | + - name: Upload to GitHub |
| 191 | + if: github.event_name == 'release' |
| 192 | + shell: bash |
| 193 | + run: | |
| 194 | + TAG_NAME=$(bash ./dist/get-tag-name.sh) |
| 195 | + bash ./dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="FedoraMediaWriter-win64-$TAG_NAME.exe" |
0 commit comments