From d3e2425b90c266a3f8db77a6cfe1d3d134843140 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 24 Dec 2021 21:50:43 +0800 Subject: [PATCH] upgrade ci config --- .github/workflows/android.yml | 71 --------------- .github/workflows/desktop.yml | 105 --------------------- .github/workflows/release.yml | 167 ++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 176 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 8c0445aae..93e356bff 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -2,8 +2,6 @@ name: Android CI on: push: - tags: - - '**' branches: - master - develop @@ -132,72 +130,3 @@ jobs: with: name: test-results-${{ matrix.api-level }}-${{ matrix.target }} path: "**/build/outputs/**/connected/**/*.xml" - - release : - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - needs: [build, unit-test, connected-test] - timeout-minutes: 30 - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 17 - - - name: Set up Android SDK License - run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses - - - name: Apply Signing - env: - ALIAS: ${{ secrets.ALIAS }} - KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} - KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} - run: ./.github/apply_signing.sh - - - name: Build with Gradle - run: ./gradlew :android:assembleRelease :android:bundleRelease - - - name: Check if is prelease - if: startsWith(github.ref, 'refs/tags/') - id: check-tag - run: | - if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then - echo ::set-output name=prelease::true - fi - - - name: Create Prerelease - if: steps.check-tag.outputs.prelease == 'true' - run: | - set -x - assets=() - for asset in $(find -name *-release.apk); do - assets+=("-a" "$asset") - done - for asset in $(find -name *-release.aab); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - if: steps.check-tag.outputs.prelease != 'true' - run: | - set -x - assets=() - for asset in $(find -name *-release.apk); do - assets+=("-a" "$asset") - done - for asset in $(find -name *-release.aab); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index a95f2f1c9..9c84c5599 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -2,8 +2,6 @@ name: Desktop CI on: push: - tags: - - '**' branches: - master - develop @@ -38,40 +36,6 @@ jobs: name: build-binaries-ubuntu path: '**/build/compose/binaries' - - name: Check if is prelease - if: startsWith(github.ref, 'refs/tags/') - id: check-tag - run: | - if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then - echo ::set-output name=prelease::true - fi - - - name: Create Prerelease - if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease == 'true' - run: | - set -x - assets=() - for asset in $(find -name *.deb); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease != 'true' - run: | - set -x - assets=() - for asset in $(find -name *.deb); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-windows: runs-on: windows-latest timeout-minutes: 30 @@ -92,40 +56,6 @@ jobs: name: build-binaries-windows path: '**/build/compose/binaries' - - name: Check if is prelease - if: startsWith(github.ref, 'refs/tags/') - id: check-tag - run: | - if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then - echo ::set-output name=prelease::true - fi - - - name: Create Prerelease - if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease == 'true' - run: | - set -x - assets=() - for asset in $(find -name *.msi); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease != 'true' - run: | - set -x - assets=() - for asset in $(find -name *.msi); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-macos: runs-on: macos-latest timeout-minutes: 30 @@ -145,38 +75,3 @@ jobs: with: name: build-binaries-macos path: '**/build/compose/binaries' - - - name: Check if is prelease - if: startsWith(github.ref, 'refs/tags/') - id: check-tag - run: | - if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then - echo ::set-output name=prelease::true - fi - - - name: Create Prerelease - if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease == 'true' - run: | - set -x - assets=() - for asset in $(find -name *.Dmg); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease != 'true' - run: | - set -x - assets=() - for asset in $(find -name *.Dmg); do - assets+=("-a" "$asset") - done - tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..cd34e8e6c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,167 @@ +name: Release CI + +on: + push: + tags: + - '**' + +jobs: + release-android: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Set up Android SDK License + run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses + + - name: Apply Signing + env: + ALIAS: ${{ secrets.ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} + run: ./.github/apply_signing.sh + + - name: Build with Gradle + run: ./gradlew :android:assembleRelease :android:bundleRelease + + - name: Archive android artifacts + uses: actions/upload-artifact@v2 + with: + name: android-release + path: | + **/*-release.aab + **/*-release.apk + + release-windows: + runs-on: windows-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Build with Gradle + run: ./gradlew :desktop:packageMsi + + - name: Archive windows artifacts + uses: actions/upload-artifact@v2 + with: + name: windows-release + path: "**/*.msi" + + release-macos: + runs-on: macos-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Build with Gradle + run: ./gradlew :desktop:packageDmg + + - name: Archive macos artifacts + uses: actions/upload-artifact@v2 + with: + name: macos-release + path: "**/*.dmg" + + release-linux: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Build with Gradle + run: ./gradlew :desktop:packageDeb + + - name: Archive linux artifacts + uses: actions/upload-artifact@v2 + with: + name: linux-release + path: "**/*.deb" + + upload-release: + runs-on: ubuntu-latest + needs: [release-android, release-linux, release-macos, release-windows] + timeout-minutes: 30 + steps: + - uses: actions/download-artifact@v2 + + - name: Check if is prelease + if: startsWith(github.ref, 'refs/tags/') + id: check-tag + run: | + if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then + echo ::set-output name=prelease::true + fi + + - name: Create Prerelease + if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease == 'true' + run: | + set -x + assets=() + for asset in $(find -name *.deb); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.msi); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.dmg); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.apk); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.aab); do + assets+=("-a" "$asset") + done + tag_name="${GITHUB_REF##*/}" + hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + if: startsWith(github.ref, 'refs/tags/') && steps.check-tag.outputs.prelease != 'true' + run: | + set -x + assets=() + for asset in $(find -name *.deb); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.msi); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.dmg); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.apk); do + assets+=("-a" "$asset") + done + for asset in $(find -name *.aab); do + assets+=("-a" "$asset") + done + tag_name="${GITHUB_REF##*/}" + hub release create "${assets[@]}" -m "$tag_name" "$tag_name" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}