From 3a5899a8b7de2eb61e8f11628529a68e22b428ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Pivo=C5=88ka?= Date: Fri, 5 May 2023 17:52:04 +0200 Subject: [PATCH] Create publish-cli.yml --- .github/workflows/publish-cli.yml | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/publish-cli.yml diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml new file mode 100644 index 0000000..1279b51 --- /dev/null +++ b/.github/workflows/publish-cli.yml @@ -0,0 +1,76 @@ +name: Publish CLI + +on: + release: + types: [ published ] + +jobs: + build: + + strategy: + matrix: + os: [ { os: windows-latest, runtime: win-x64 }, { os: ubuntu-latest, runtime: linux-x64 } ] + + runs-on: ${{ matrix.os.os }} + + name: Publish on ${{ matrix.os.os }} + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Publish ${{ matrix.os.runtime }} + run: dotnet publish ClipCheckpointCLI -c Release -f net7.0 -r ${{ matrix.os.runtime }} -o build/ClipCheckpointCLI-${{ matrix.os.runtime }} -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:PublishTrimmed=true --self-contained + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: build + path: build + + publish: + needs: build + + strategy: + matrix: + os: [ { os: windows-latest, runtime: win-x64 }, { os: ubuntu-latest, runtime: linux-x64 } ] + + runs-on: ${{ matrix.os.os }} + + steps: + - name: Download a Build Artifact + uses: actions/download-artifact@v3.0.0 + with: + name: build + + - name: Zip to ClipCheckpointCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip + uses: thedoctor0/zip-release@main + with: + path: ClipCheckpointCLI-${{ matrix.os.runtime }} + filename: ClipCheckpointCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip + + - name: SHA256 checksum + uses: Huy-Ngo/gha-sha@v1.1.0 + with: + glob: ClipCheckpointCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip + + - name: Upload ClipCheckpointCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip to latest release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ClipCheckpointCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip + tag: ${{ github.ref }} + overwrite: true + body: | + ${{ github.event.release.body }} + + The ZIP was automatically generated using the [publish workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).