WindSend Release #60
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: WindSend Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-linux: | |
| # runs-on: [ubuntu-latest, ubuntu-22.04] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-22.04, ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch tags | |
| run: | | |
| git fetch --tags || true | |
| git tag --sort=-creatordate | head -n 1 | |
| # 缓存 cargo 依赖 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-git- | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: windSend-rs/target | |
| key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-build- | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| target: aarch64-unknown-linux-gnu | |
| - name: rustup show | |
| run: rustup show | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "adopt" | |
| - name: Setup Ninja | |
| uses: seanmiddleditch/gha-setup-ninja@master | |
| - name: Install dependencies on Ubuntu | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libxdo-dev libappindicator3-dev | |
| sudo apt-get install -y pkg-config libssl-dev build-essential linux-libc-dev | |
| sudo apt-get install -y musl-dev musl-tools | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Setup Flutter | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - name: Print Flutter Info | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| flutter --version | |
| flutter doctor | |
| # download flutter dependencies(to generate pubspec.lock) | |
| - name: Download Flutter Dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| working-directory: flutter/wind_send | |
| run: flutter pub get | |
| # cache flutter build | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| flutter/wind_send/build/ | |
| ~/.pub-cache | |
| key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-flutter- | |
| - name: Cearate Key Store | |
| run: echo "$SIGNING_KEY" | base64 -d >flutter/wind_send/android/app/key.jks | |
| env: | |
| SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
| - name: Run Build Script on Ubuntu 22.04 | |
| if: matrix.os == 'ubuntu-22.04' | |
| env: | |
| CI_RUNNING: true # for build script | |
| COMPATIBLE_SYSTEM: true | |
| working-directory: ./ | |
| run: | | |
| chmod +x ./*.sh | |
| ./build_linux.sh | |
| - name: Run Build Script | |
| if: matrix.os == 'ubuntu-latest' | |
| env: | |
| CI_RUNNING: true # for build script | |
| KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| ALIAS: ${{ secrets.ALIAS }} | |
| KEY_PATH: key.jks | |
| working-directory: ./ | |
| run: | | |
| chmod +x ./*.sh | |
| ./build_linux.sh | |
| ./build_android.sh | |
| # generate test zip file | |
| # run: | | |
| # mkdir -p ./bin | |
| # echo "Hello, World!" > ./bin/test.txt | |
| # zip -r ./bin/test.zip ./bin/test.txt | |
| # echo "Hello, World!" > ./bin/test.apk | |
| - name: Archive artifacts on Ubuntu latest | |
| if: matrix.os == 'ubuntu-latest' | |
| id: build_archive1 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WindSend-Archives-ubuntu-latest | |
| path: | | |
| ./bin/*.zip | |
| ./bin/*.apk | |
| if-no-files-found: error | |
| - name: Archive artifacts on Ubuntu 22.04 | |
| if: matrix.os == 'ubuntu-22.04' | |
| id: build_archive2 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WindSend-Archives-ubuntu-22.04 | |
| path: | | |
| ./bin/*.zip | |
| ./bin/*.apk | |
| if-no-files-found: error | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch tags | |
| run: | | |
| git fetch --tags || true | |
| git tag --sort=-creatordate | head -n 1 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| windSend-rs/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| target: aarch64-pc-windows-msvc | |
| - name: rustup show | |
| run: rustup show | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "adopt" | |
| - name: Install NASM | |
| uses: ilammy/setup-nasm@v1 | |
| - name: Setup Ninja | |
| uses: seanmiddleditch/gha-setup-ninja@master | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - run: | | |
| flutter --version | |
| flutter doctor | |
| # download flutter dependencies(to generate pubspec.lock) | |
| - name: Download Flutter Dependencies | |
| working-directory: flutter/wind_send | |
| run: flutter pub get | |
| # cache flutter build | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| flutter/wind_send/build/ | |
| ~/.pub-cache | |
| key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-flutter- | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| path-type: "inherit" | |
| install: >- | |
| zip | |
| - name: Run Build Script | |
| shell: msys2 {0} | |
| env: | |
| CI_RUNNING: true # for build script | |
| working-directory: ./ | |
| run: | | |
| ./build_windows.sh | |
| - name: Archive artifacts | |
| id: build_archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WindSend-Archives-windows | |
| path: | | |
| ./bin/*.zip | |
| ./bin/*.apk | |
| if-no-files-found: error | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch tags | |
| run: | | |
| git fetch --tags || true | |
| git tag --sort=-creatordate | head -n 1 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| windSend-rs/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| target: x86_64-apple-darwin, aarch64-apple-darwin | |
| - name: Set default Rust target | |
| run: | | |
| rustup show | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "adopt" | |
| - name: Setup Ninja | |
| uses: seanmiddleditch/gha-setup-ninja@master | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| - name: Print Flutter Info | |
| run: | | |
| flutter --version | |
| # download flutter dependencies(to generate pubspec.lock) | |
| - name: Download Flutter Dependencies | |
| working-directory: flutter/wind_send | |
| run: flutter pub get | |
| # cache flutter build | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| flutter/wind_send/build/ | |
| ~/.pub-cache | |
| key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-flutter- | |
| - name: Run Build Script | |
| env: | |
| CI_RUNNING: true # for build script | |
| working-directory: ./ | |
| run: | | |
| chmod +x ./*.sh | |
| ./build_macos.sh | |
| - name: Archive artifacts | |
| id: build_archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WindSend-Archives-macos | |
| path: | | |
| ./bin/*.zip | |
| if-no-files-found: error | |
| release: | |
| needs: [build-linux, build-windows, build-macos] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # name: WindSend-Archives-linux | |
| path: ./Downloaded-Archives | |
| merge-multiple: true | |
| - name: Echo env | |
| run: | | |
| echo 'ref ${{ github.ref }}' | |
| echo 'ref name ${{ github.ref_name }}' | |
| echo 'sha ${{ github.sha }}' | |
| echo 'actor ${{ github.actor }}' | |
| echo 'repository ${{ github.repository }}' | |
| echo 'repository_owner ${{ github.repository_owner }}' | |
| echo 'event_name ${{ github.event_name }}' | |
| echo 'event_path ${{ github.event_path }}' | |
| echo 'workspace ${{ github.workspace }}' | |
| echo 'action ${{ github.action }}' | |
| echo 'job ${{ github.job }}' | |
| echo 'run_id ${{ github.run_id }}' | |
| echo 'run_number ${{ github.run_number }}' | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| # if: startsWith(github.ref, 'refs/tags/') # e.g. refs/tags/v1.0.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: | | |
| ./Downloaded-Archives/*.zip | |
| ./Downloaded-Archives/*.apk | |
| draft: true |