diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..e825fb7f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,320 @@ +name: build + +on: + workflow_dispatch: + release: + types: [published] +jobs: + get-release: + runs-on: ubuntu-latest + outputs: + tag_name: ${{ steps.get_release.outputs.tag_name }} + upload_url: ${{ steps.get_release.outputs.upload_url }} + + steps: + - uses: actions/checkout@v3 + - uses: thebritican/fetch-latest-release@v2 + id: get_release + with: + github_token: ${{ github.token }} + build-windows: + runs-on: windows-latest + needs: [get_release] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "^1.19" + cache: true + - uses: subosito/flutter-action@v2 + - name: Build + env: + VERSION: ${{ needs.get_release.outputs.tag_name }} + run: | + go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/windows/libgopeed.dll github.com/monkeyWie/gopeed/bind/desktop + cd ui/flutter + flutter build windows + $mingw = "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin" + $system = "C:\Windows\System32" + $release = "build\windows\runner\Release\" + cp $mingw\libstdc++-6.dll $release + cp $mingw\libgcc_s_seh-1.dll $release + cp $mingw\libwinpthread-1.dll $release + cp $system\msvcp140.dll $release + cp $system\vcruntime140.dll $release + cp $system\vcruntime140_1.dll $release + + cd build/windows + echo @" + ; Script generated by the Inno Setup Script Wizard. + ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + + #define MyAppName "Gopeed" + #define MyAppVersion "$($env:VERSION.substring(1))" + #define MyAppPublisher "monkeyWie" + #define MyAppURL "https://gopeed.com" + #define MyAppExeName "gopeed.exe" + + [Setup] + ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. + ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) + AppId={{5960F34D-1E42-402C-8C85-DE2FF24CBAE4} + AppName={#MyAppName} + AppVersion={#MyAppVersion} + ;AppVerName={#MyAppName} {#MyAppVersion} + AppPublisher={#MyAppPublisher} + AppPublisherURL={#MyAppURL} + AppSupportURL={#MyAppURL} + AppUpdatesURL={#MyAppURL} + DefaultDirName={autopf}\gopeed + DisableProgramGroupPage=yes + LicenseFile=..\..\..\..\LICENSE + ; Remove the following line to run in administrative install mode (install for all users.) + PrivilegesRequired=lowest + OutputBaseFilename=gopeed + SetupIconFile=..\..\assets\icon\icon.ico + Compression=lzma + SolidCompression=yes + WizardStyle=modern + + [Languages] + Name: "english"; MessagesFile: "compiler:Default.isl" + + [Tasks] + Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + + [Files] + Source: ".\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs + ; NOTE: Don't use "Flags: ignoreversion" on any shared system files + + [Icons] + Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" + Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + + [Run] + Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + "@ > setup.iss + iscc.exe setup.iss + mv "Output\gopeed.exe" "Output\Gopeed-$env:VERSION-windows-amd64.exe" + - name: Upload + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ui/flutter/build/windows/Output/* + overwrite: true + build-macos-arm64-lib: + runs-on: ubuntu-latest + needs: [get_release] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "^1.19" + cache: true + - run: mkdir -p ~/image-cache + - id: image-cache + uses: actions/cache@v3 + with: + path: ~/image-cache + key: image-cache-xgo-v1.19 + - if: steps.image-cache.outputs.cache-hit != 'true' + run: | + docker pull techknowlogick/xgo:go-1.19.x + docker save -o ~/image-cache/xgo.tar techknowlogick/xgo:go-1.19.x + - if: steps.image-cache.outputs.cache-hit == 'true' + run: docker load -i ~/image-cache/xgo.tar + - name: Build + run: | + go install src.techknowlogick.com/xgo@latest + xgo --targets=darwin/arm64 -tags="nosqlite" -ldflags="-w -s" -buildmode=c-shared -pkg=bind/desktop -out=libgopeed . + mv libgopeed-*.dylib libgopeed.dylib + - uses: actions/upload-artifact@v3 + with: + name: macos-arm64-lib + path: libgopeed.dylib + build-macos: + runs-on: macos-latest + needs: [release, build-macos-arm64-lib] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "^1.19" + cache: true + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: subosito/flutter-action@v2 + - name: Install appdmg + run: npm install -g appdmg + - uses: actions/download-artifact@v3 + with: + name: macos-arm64-lib + path: ui/flutter/macos/Frameworks + - name: Build + env: + VERSION: ${{ needs.get_release.outputs.tag_name }} + run: | + PROJECT_DIR=$(pwd) + + cd ui/flutter + flutter build macos + cd build/macos/Build/Products/Release + cat>appdmg.json<debian/debian.yaml<debian/gui/gopeed.desktop< setup.iss - iscc.exe setup.iss - mv "Output\gopeed.exe" "Output\Gopeed-$env:VERSION-windows-amd64.exe" - - name: Upload - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ui/flutter/build/windows/Output/* - overwrite: true - build-macos-arm64-lib: - runs-on: ubuntu-latest - needs: [ release ] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: '^1.19' - cache: true - - run: mkdir -p ~/image-cache - - id: image-cache - uses: actions/cache@v3 - with: - path: ~/image-cache - key: image-cache-xgo-v1.19 - - if: steps.image-cache.outputs.cache-hit != 'true' - run: | - docker pull techknowlogick/xgo:go-1.19.x - docker save -o ~/image-cache/xgo.tar techknowlogick/xgo:go-1.19.x - - if: steps.image-cache.outputs.cache-hit == 'true' - run: docker load -i ~/image-cache/xgo.tar - - name: Build - run: | - go install src.techknowlogick.com/xgo@latest - xgo --targets=darwin/arm64 -tags="nosqlite" -ldflags="-w -s" -buildmode=c-shared -pkg=bind/desktop -out=libgopeed . - mv libgopeed-*.dylib libgopeed.dylib - - uses: actions/upload-artifact@v3 - with: - name: macos-arm64-lib - path: libgopeed.dylib - build-macos: - runs-on: macos-latest - needs: [ release, build-macos-arm64-lib ] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: '^1.19' - cache: true - - uses: actions/setup-node@v3 - with: - node-version: 16 - - uses: subosito/flutter-action@v2 - - name: Install appdmg - run: npm install -g appdmg - - uses: actions/download-artifact@v3 - with: - name: macos-arm64-lib - path: ui/flutter/macos/Frameworks - - name: Build - env: - VERSION: ${{ needs.release.outputs.tag_name }} - run: | - PROJECT_DIR=$(pwd) - - cd ui/flutter - flutter build macos - cd build/macos/Build/Products/Release - cat>appdmg.json<debian/debian.yaml<debian/gui/gopeed.desktop<