From ddc1f0b4f7ecc42e35456276e6902987dab50a67 Mon Sep 17 00:00:00 2001 From: graphemecluster Date: Tue, 9 Jan 2024 17:55:29 +0800 Subject: [PATCH] Fix Workflow --- .github/workflows/build-ci.yml | 32 +++++++++++++++++++++++ .github/workflows/commit-ci.yml | 19 -------------- .github/workflows/linux-build.yml | 2 +- .github/workflows/macos-build.yml | 14 ++++------- .github/workflows/release-ci.yml | 39 ----------------------------- .github/workflows/windows-build.yml | 11 ++++---- action-install-plugins-macos.sh | 2 +- action-install-plugins-windows.bat | 3 +-- 8 files changed, 45 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/build-ci.yml delete mode 100644 .github/workflows/commit-ci.yml delete mode 100644 .github/workflows/release-ci.yml diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml new file mode 100644 index 0000000000..389f3d1094 --- /dev/null +++ b/.github/workflows/build-ci.yml @@ -0,0 +1,32 @@ +name: Build CI + +on: + push: + pull_request: + +jobs: + linux: + uses: ./.github/workflows/linux-build.yml + + macos: + uses: ./.github/workflows/macos-build.yml + with: + build_variant: ${{ startsWith(github.ref, 'refs/tags/') && '-universal' || '' }} + + windows: + uses: ./.github/workflows/windows-build.yml + + release: + needs: [macos, windows] + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/') && success() }} + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + with: + name: "librime for TypeDuck: ${{ github.ref_name }}" + files: | + artifact/* diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml deleted file mode 100644 index d6f45d8fc6..0000000000 --- a/.github/workflows/commit-ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Commit CI - -on: - push: - branches: - - '*' - tags: - - '![0-9]+.*' - pull_request: - -jobs: - linux: - uses: ./.github/workflows/linux-build.yml - - macos: - uses: ./.github/workflows/macos-build.yml - - windows: - uses: ./.github/workflows/windows-build.yml diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 56d7ccddde..6fa5dd03b4 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -16,7 +16,7 @@ jobs: compiler: [g++, clang] steps: - name: Checkout last commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ inputs.repository }} submodules: recursive diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 2272e905df..8dde97ee4a 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -21,15 +21,11 @@ jobs: RIME_PLUGINS: ${{ inputs.rime_plugins }} steps: - name: Checkout last commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ inputs.repository }} submodules: recursive - - name: Configure build environment - run: | - echo git_ref_name="$(git describe --always)" >> $GITHUB_ENV - - name: Configure build variant if: contains(inputs.build_variant, '-universal') run: | @@ -82,9 +78,9 @@ jobs: - name: Create distributable run: | make xcode/dist - tar -cjvf rime-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.tar.bz2 \ + tar -cjvf rime-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.tar.bz2 \ dist version-info.txt - tar -cjvf rime-deps-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.tar.bz2 \ + tar -cjvf rime-deps-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.tar.bz2 \ --exclude '*/.placeholder' \ bin include lib share @@ -92,5 +88,5 @@ jobs: uses: actions/upload-artifact@v3 with: path: | - rime-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.tar.bz2 - rime-deps-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.tar.bz2 + rime-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.tar.bz2 + rime-deps-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.tar.bz2 diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml deleted file mode 100644 index ba2a728492..0000000000 --- a/.github/workflows/release-ci.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Release CI - -on: - workflow_dispatch: - push: - tags: - - '[0-9]+.*' - -jobs: - linux: - uses: ./.github/workflows/linux-build.yml - - macos: - uses: ./.github/workflows/macos-build.yml - with: - build_variant: '-universal' - - windows: - uses: ./.github/workflows/windows-build.yml - - release: - needs: [macos, windows] - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - - - name: Get version name - run: | - echo rime_version="$(git describe --always)" >> $env:GITHUB_ENV - - - name: Create GitHub release - uses: 'marvinpinto/action-automatic-releases@latest' - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: ${{ env.rime_version }} - title: "librime for TypeDuck: ${{ env.rime_version }}" - files: | - artifact/* diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 543594ef47..1ad561a01c 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -18,7 +18,7 @@ jobs: RIME_PLUGINS: ${{ inputs.rime_plugins }} steps: - name: Checkout last commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ inputs.repository }} submodules: recursive @@ -26,7 +26,6 @@ jobs: - name: Configure build environment run: | copy env.vs2022.bat env.bat - echo git_ref_name="$(git describe --always)" >> $env:GITHUB_ENV - name: Cache Boost id: cache-boost @@ -74,14 +73,14 @@ jobs: - name: Create distributable run: | - 7z a rime-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.7z ` + 7z a rime-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.7z ` dist version-info.txt - 7z a -x'!*/.placeholder' rime-deps-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.7z ` + 7z a -x'!*/.placeholder' rime-deps-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.7z ` bin include lib share - name: Upload artifacts uses: actions/upload-artifact@v3 with: path: | - rime-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.7z - rime-deps-TypeDuck-${{ env.git_ref_name }}-${{ runner.os }}.7z + rime-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.7z + rime-deps-TypeDuck-${{ github.ref_name }}-${{ runner.os }}.7z diff --git a/action-install-plugins-macos.sh b/action-install-plugins-macos.sh index d8888c59e5..6c79fed8fb 100755 --- a/action-install-plugins-macos.sh +++ b/action-install-plugins-macos.sh @@ -3,7 +3,7 @@ export RIME_ROOT="$(cd "$(dirname "$0")"; pwd)" echo "RIME_PLUGINS=${RIME_PLUGINS}" > version-info.txt -echo "librime $(git describe --always)" >> version-info.txt +echo "librime ${GITHUB_REF_NAME}" >> version-info.txt function action_install_plugin() { local plugin="$1" diff --git a/action-install-plugins-windows.bat b/action-install-plugins-windows.bat index 323def4f93..9095a22499 100644 --- a/action-install-plugins-windows.bat +++ b/action-install-plugins-windows.bat @@ -9,8 +9,7 @@ set clone_options=^ --no-single-branch echo RIME_PLUGINS=%RIME_PLUGINS% > version-info.txt -echo librime >> version-info.txt -git describe --always >> version-info.txt +echo librime %GITHUB_REF_NAME% >> version-info.txt if defined RIME_PLUGINS ( for %%s in (%RIME_PLUGINS%) do call :install_plugin %%s || exit /b