Skip to content

Publish CLI

Publish CLI #4

Workflow file for this run

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: Add GitHub NuGet source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/bigbang1112-cz/index.json"
- name: Restore dependencies
run: dotnet restore
- name: Publish ${{ matrix.os.runtime }}
run: dotnet publish GhostToClipCLI -c Release -f net7.0 -r ${{ matrix.os.runtime }} -o build/GhostToClipCLI-${{ matrix.os.runtime }} -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:PublishTrimmed=true -p:TrimMode=partial --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 GhostToClipCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip
uses: thedoctor0/zip-release@main
with:
path: GhostToClipCLI-${{ matrix.os.runtime }}
filename: GhostToClipCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip
- name: SHA256 checksum
uses: Huy-Ngo/gha-sha@v1.1.0
with:
glob: GhostToClipCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip
- name: Upload GhostToClipCLI-${{ matrix.os.runtime }}.${{ github.ref_name }}.zip to latest release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: GhostToClipCLI-${{ 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 }}).