diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 8a5ff758..262c1d6d 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -1,14 +1,10 @@ name: Commit CI -on: - push: - branches: [master] +on: [push] jobs: - build-winform: - runs-on: windows-latest - permissions: - contents: write + linux: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,32 +14,22 @@ jobs: dotnet-version: "8.0.x" - name: Restore dependencies - run: dotnet restore "./src/IME WL Converter Win" + run: dotnet restore ./src/ImeWlConverterCmd - name: Publish - run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win" - - - name: Archive Release - run: 7z a -tzip imewlconverter_Windows.zip publish/ + run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd - - uses: ncipollo/release-action@v1 + - name: Upload Artifact + uses: actions/upload-artifact@v4 with: - artifacts: "imewlconverter_Windows.zip" - allowUpdates: true - prerelease: true - commit: master - tag: "preview" - name: "Preview" - generateReleaseNotes: true - token: ${{ secrets.GITHUB_TOKEN }} - - build-cmd: + name: "imewlconverter_Linux.tar.gz" + path: ./publish + + macos: + runs-on: macos-latest strategy: matrix: - os: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.os }} - permissions: - contents: write + arch: [x64, arm64] steps: - uses: actions/checkout@v4 @@ -56,26 +42,16 @@ jobs: run: dotnet restore ./src/ImeWlConverterCmd - name: Publish - run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd + run: dotnet publish --configuration Release --output ./publish-${{ matrix.arch }} ./src/ImeWlConverterCmd -a ${{ matrix.arch }} - - name: Archive Release - run: tar -czf imewlconverter_${{ runner.os }}.tar.gz publish/* - - - uses: ncipollo/release-action@v1 + - name: Upload Artifact + uses: actions/upload-artifact@v4 with: - artifacts: "imewlconverter_${{ runner.os }}.tar.gz" - allowUpdates: true - prerelease: true - commit: master - tag: "preview" - name: "Preview" - generateReleaseNotes: true - token: ${{ secrets.GITHUB_TOKEN }} - - build-mac-arm64: - runs-on: macos-latest - permissions: - contents: write + name: "imewlconverter_macOS-${{ matrix.arch }}" + path: ./publish-${{ matrix.arch }} + + windows: + runs-on: windows-latest steps: - uses: actions/checkout@v4 @@ -85,21 +61,13 @@ jobs: dotnet-version: "8.0.x" - name: Restore dependencies - run: dotnet restore ./src/ImeWlConverterCmd + run: dotnet restore "./src/IME WL Converter Win" - name: Publish - run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd -a arm64 - - - name: Archive Release - run: tar -czf imewlconverter_${{ runner.os }}-aarch64.tar.gz publish/* + run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win" - - uses: ncipollo/release-action@v1 + - name: Upload Artifact + uses: actions/upload-artifact@v4 with: - artifacts: "imewlconverter_${{ runner.os }}-aarch64.tar.gz" - allowUpdates: true - prerelease: true - commit: master - tag: "preview" - name: "Preview" - generateReleaseNotes: true - token: ${{ secrets.GITHUB_TOKEN }} + name: imewlconverter_Windows + path: ./publish diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index 633e29a8..00000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Pull Request CI - -on: - pull_request: - branches: [master] - -jobs: - build-winform: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "8.0.x" - - - name: Restore dependencies - run: dotnet restore "./src/IME WL Converter Win" - - - name: Publish - run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win" - - - name: Archive artifacts - uses: actions/upload-artifact@v4 - with: - name: WinFormApp - path: ./publish - - build-cmd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "8.0.x" - - - name: Restore dependencies - run: dotnet restore ./src/ImeWlConverterCmd - # - name: Build - # run: dotnet build --no-restore ./src/ImeWlConverterCmd - - - name: Test - run: dotnet test --no-build --verbosity normal ./src/ImeWlConverterCoreTest/ImeWlConverterCoreTest.csproj - - - name: Publish - run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd - - - name: Archive artifacts - uses: actions/upload-artifact@v4 - with: - name: Cmd - path: ./publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88b88652..3a9dc26d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,50 +6,59 @@ on: - "v*" jobs: - build-winform: - runs-on: windows-latest + linux: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Generate CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ github.token }} + tag: ${{ github.ref_name }} + writeToFile: false + includeInvalidCommits: true + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: "8.0.x" - name: Restore dependencies - run: dotnet restore "./src/IME WL Converter Win" + run: dotnet restore ./src/ImeWlConverterCmd - name: Publish - run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win" - - - name: Archive Release - run: 7z a -tzip imewlconverter_Windows.zip publish/ + run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd - - name: Update CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ github.token }} - tag: ${{ github.ref_name }} - writeToFile: false - includeInvalidCommits: true + - name: Archive + run: tar -czf imewlconverter_Linux.tar.gz publish/* - uses: ncipollo/release-action@v1 with: - artifacts: "imewlconverter_Windows.zip" + artifacts: "imewlconverter_Linux.tar.gz" allowUpdates: true body: | ${{ steps.changelog.outputs.changes }} token: ${{ secrets.GITHUB_TOKEN }} - build-cmd: + macos: + runs-on: macos-latest strategy: matrix: - os: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.os }} + arch: [x64, arm64] steps: - uses: actions/checkout@v4 + - name: Generate CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ github.token }} + tag: ${{ github.ref_name }} + writeToFile: false + includeInvalidCommits: true + - name: Setup .NET uses: actions/setup-dotnet@v4 with: @@ -59,59 +68,50 @@ jobs: run: dotnet restore ./src/ImeWlConverterCmd - name: Publish - run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd - - - name: Archive Release - run: tar -czf imewlconverter_${{ runner.os }}.tar.gz publish/* + run: dotnet publish --configuration Release --output ./publish-${{ matrix.arch }} ./src/ImeWlConverterCmd -a ${{ matrix.arch }} - - name: Update CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ github.token }} - tag: ${{ github.ref_name }} - writeToFile: false - includeInvalidCommits: true + - name: Archive + run: tar -czf imewlconverter_macOS-${{ matrix.arch }}.tar.gz publish-${{ matrix.arch }}/* - uses: ncipollo/release-action@v1 with: - artifacts: "imewlconverter_${{ runner.os }}.tar.gz" + artifacts: "imewlconverter_macOS-${{ matrix.arch }}.tar.gz" allowUpdates: true body: | ${{ steps.changelog.outputs.changes }} token: ${{ secrets.GITHUB_TOKEN }} - build-mac-arm64: - runs-on: macos-latest + windows: + runs-on: windows-latest steps: - uses: actions/checkout@v4 + - name: Generate CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ github.token }} + tag: ${{ github.ref_name }} + writeToFile: false + includeInvalidCommits: true + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: "8.0.x" - name: Restore dependencies - run: dotnet restore ./src/ImeWlConverterCmd + run: dotnet restore "./src/IME WL Converter Win" - name: Publish - run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd -a arm64 - - - name: Archive Release - run: tar -czf imewlconverter_${{ runner.os }}-aarch64.tar.gz publish/* + run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win" - - name: Update CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ github.token }} - tag: ${{ github.ref_name }} - writeToFile: false - includeInvalidCommits: true + - name: Archive + run: 7z a -tzip imewlconverter_Windows.zip publish/ - uses: ncipollo/release-action@v1 with: - artifacts: "imewlconverter_${{ runner.os }}-aarch64.tar.gz" + artifacts: "imewlconverter_Windows.zip" allowUpdates: true body: | ${{ steps.changelog.outputs.changes }} diff --git a/README.md b/README.md index be0e2db6..1e7ad9b0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # 深蓝词库转换 [![Stars](https://img.shields.io/github/stars/studyzy/imewlconverter)](https://github.com/studyzy/imewlconverter/stargazers) -![Actions Check](https://github.com/studyzy/imewlconverter/actions/workflows/winform.yml/badge.svg) +![Actions Check](https://github.com/studyzy/imewlconverter/actions/workflows/commit.yml/badge.svg) ![License](https://img.shields.io/github/license/studyzy/imewlconverter) ![Repo size](https://img.shields.io/github/repo-size/studyzy/imewlconverter) [![Code Count](https://tokei.rs/b1/github/studyzy/imewlconverter)](https://github.com/studyzy/imewlconverter)