From ccb1e995bc8a1d2f7d130439bb905e8c6b9d5da3 Mon Sep 17 00:00:00 2001 From: liudonghua123 Date: Fri, 20 Mar 2020 12:14:08 +0800 Subject: [PATCH] add github workflow --- .github/workflows/linux.yml | 56 ++++++++++++++++++++++++++++++++ .github/workflows/macos.yml | 61 +++++++++++++++++++++++++++++++++++ .github/workflows/web.yml | 35 ++++++++++++++++++++ .github/workflows/windows.yml | 52 +++++++++++++++++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/web.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..ced7fe18 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,56 @@ +name: Linux-CI + +on: + push: + branches: + - isomorphic + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Branch name + id: branch_name + run: | + echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + + - uses: actions/setup-java@v1 + with: + java-version: "8.x" + - uses: subosito/flutter-action@v1 + with: + channel: "dev" + + - name: Change flutter channel to master, enable linux support + run: | + flutter channel master + flutter upgrade + flutter config --enable-linux-desktop + flutter pub get + + - name: Build linux + run: | + flutter build linux + + - name: Debug + run: | + sudo npm install tree-node-cli -g + treee build + + - name: Prepare release files + run: | + cp -r build/linux/release flutter_ui_challenges-linux-${{ steps.branch_name.outputs.SOURCE_NAME }} + zip flutter_ui_challenges-linux-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip -r flutter_ui_challenges-linux-${{ steps.branch_name.outputs.SOURCE_NAME }} + + - uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + file: flutter_ui_challenges-linux-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip + tags: true + draft: false diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..b555cc88 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,61 @@ +name: MacOS-CI + +on: + push: + branches: + - isomorphic + tags: + - "*" + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Branch name + id: branch_name + run: | + echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + + - uses: actions/setup-java@v1 + with: + java-version: "8.x" + - uses: subosito/flutter-action@v1 + with: + channel: "dev" + + - name: Change flutter channel to master, enable macos support + run: | + flutter channel master + flutter upgrade + flutter config --enable-macos-desktop + flutter pub get + + - name: Build macos, apk, ios(simulator) + run: | + flutter build macos + flutter build apk + flutter build ios --debug --no-codesign --simulator + + - name: Debug + run: | + sudo npm install tree-node-cli -g + treee build + + - name: Prepare release files + run: | + cp -r build/macos/Build/Products/Release/flutter_ui_challenges.app flutter_ui_challenges-macos-${{ steps.branch_name.outputs.SOURCE_NAME }}.app + cp -r build/ios/Debug-iphonesimulator/Runner.app flutter_ui_challenges-ios-${{ steps.branch_name.outputs.SOURCE_NAME }}.app + zip flutter_ui_challenges-macos-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip -r flutter_ui_challenges-macos-${{ steps.branch_name.outputs.SOURCE_NAME }}.app + zip flutter_ui_challenges-ios-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip -r flutter_ui_challenges-ios-${{ steps.branch_name.outputs.SOURCE_NAME }}.app + cp build/app/outputs/apk/release/app-release.apk flutter_ui_challenges-android-${{ steps.branch_name.outputs.SOURCE_NAME }}.apk + + - uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + file: flutter_ui_challenges-macos-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip;flutter_ui_challenges-ios-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip;flutter_ui_challenges-android-${{ steps.branch_name.outputs.SOURCE_NAME }}.apk + tags: true + draft: false diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 00000000..9bd6ceb3 --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,35 @@ +name: WEB-CI + +on: + push: + branches: + - isomorphic + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-java@v1 + with: + java-version: "8.x" + - uses: subosito/flutter-action@v1 + with: + channel: "beta" + + - name: Enable web support + run: | + flutter upgrade + flutter config --enable-web + flutter pub get + + - name: Build web + run: | + flutter build web + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build/web/ \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..338a245f --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,52 @@ +name: Windows-CI + +on: + push: + branches: + - isomorphic + tags: + - '*' + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + - name: Branch name + id: branch_name + run: | + echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + shell: bash + + - uses: actions/setup-java@v1 + with: + java-version: "8.x" + - uses: subosito/flutter-action@v1 + with: + channel: "dev" + + - name: Change flutter channel to master, enable windows support + run: | + flutter channel master + flutter upgrade + flutter config --enable-windows-desktop + flutter pub get + + - name: Build windows + run: | + flutter build windows + + - name: Prepare release files + run: | + 7z a -tzip flutter_ui_challenges-windows-x64-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip -r .\build\windows\x64\Release\Runner\* + + - uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + file: flutter_ui_challenges-windows-x64-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip + tags: true + draft: false \ No newline at end of file