Skip to content

Commit

Permalink
Create publish-cli.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 authored May 5, 2023
1 parent be4b7d0 commit d9c49c8
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -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 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 --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 }}).

0 comments on commit d9c49c8

Please sign in to comment.