From 7434e59b45a0c780508021ee0848b1be60692fed Mon Sep 17 00:00:00 2001 From: pdone <617941447@qq.com> Date: Mon, 17 Jun 2024 16:53:48 +0800 Subject: [PATCH] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 41 +++++++++++++------ .../workflows/{build-test.yml => test.yml} | 2 +- 2 files changed, 30 insertions(+), 13 deletions(-) rename .github/workflows/{build-test.yml => test.yml} (96%) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 09725c8..caa6899 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -6,33 +6,50 @@ on: jobs: build: - runs-on: ubuntu-latest - + env: + REPO_NAME: ${{ github.event.repository.name }} 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 - - name: Build run: dotnet build --configuration Release --no-restore - - - name: Zip + - name: Publish Linux + if: startsWith(github.ref, 'refs/tags/') + run: | + RT_OS="linux-x64" + FILE_NAME="$REPO_NAME-$RT_OS" + echo $FILE_NAME + mkdir $FILE_NAME + dotnet publish -c Release -r $RT_OS --property:PublishDir=$FILE_NAME + zip $FILE_NAME.zip $FILE_NAME + - name: Publish Win + if: startsWith(github.ref, 'refs/tags/') + run: | + RT_OS="win-x64" + FILE_NAME="$REPO_NAME-$RT_OS" + echo $FILE_NAME + mkdir $FILE_NAME + dotnet publish -c Release -r $RT_OS --property:PublishDir=$FILE_NAME + zip $FILE_NAME.zip $FILE_NAME + - name: Publish Osx if: startsWith(github.ref, 'refs/tags/') run: | - mkdir ${{ github.event.repository.name }} - cp -a /bin/Release/net8.0/* ${{ github.event.repository.name }} - zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }} - - - name: Publish + RT_OS="osx-x64" + FILE_NAME="$REPO_NAME-$RT_OS" + echo $FILE_NAME + mkdir $FILE_NAME + dotnet publish -c Release -r $RT_OS --property:PublishDir=$FILE_NAME + zip $FILE_NAME.zip $FILE_NAME + - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - files: ${{ github.event.repository.name }}.zip + files: AutoUpdateConfig-*.zip name: ${{ github.ref_name }} draft: true diff --git a/.github/workflows/build-test.yml b/.github/workflows/test.yml similarity index 96% rename from .github/workflows/build-test.yml rename to .github/workflows/test.yml index 7a67dc8..cb86fc6 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Build Test +name: Test on: push: