Skip to content

Commit

Permalink
Update build-and-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pdone committed Jun 17, 2024
1 parent bca5212 commit 717077d
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
dotnet publish -c Release -r $RT_OS
zip -r $FILE_NAME.zip ./bin/Release/net8.0/$RT_OS/publish/*
- name: Publish Win
if: startsWith(github.ref, 'refs/tags/')
run: |
RT_OS="win-x64"
FILE_NAME="$REPO_NAME-$RT_OS"
echo $FILE_NAME
dotnet publish -c Release -r $RT_OS
zip -r $FILE_NAME.zip ./bin/Release/net8.0/$RT_OS/publish/*
- 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
dotnet publish -c Release -r $RT_OS
zip -r $FILE_NAME.zip ./bin/Release/net8.0/$RT_OS/publish/*
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.event.repository.name }}.zip
files: |
$REPO_NAME-linux-x64.zip
$REPO_NAME-win-x64.zip
$REPO_NAME-osx-x64.zip
name: ${{ github.ref_name }}
draft: true

0 comments on commit 717077d

Please sign in to comment.