chore: add console publish github action workflow
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
name: Publish Console
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- src/StreamShorts.Console/**
|
||||
- src/StreamShorts.Console.Tests/**
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Install versionize
|
||||
run: dotnet tool install --global Versionize
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "65925598+StevanFreeborn@users.noreply.github.com"
|
||||
git config --local user.name "Stevan Freeborn"
|
||||
- name: Run versionize
|
||||
id: versionize
|
||||
run: versionize -i --exit-insignificant-commits --workingDir ./src/StreamShorts.Console --commit-suffix "[skip ci]"
|
||||
continue-on-error: true
|
||||
- name: Upload changelog
|
||||
if: steps.versionize.outcome == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: change-log
|
||||
path: src/StreamShorts.Console/CHANGELOG.md
|
||||
- name: Push changes to GitHub
|
||||
if: steps.versionize.outcome == 'success'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.ACTIONS_PAT }}
|
||||
branch: ${{ github.ref }}
|
||||
tags: true
|
||||
outputs:
|
||||
is_new_version: ${{ steps.versionize.outcome == 'success' }}
|
||||
publish:
|
||||
needs: [version]
|
||||
if: needs.version.outputs.is_new_version == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Build
|
||||
run: dotnet build src
|
||||
- name: Publish for mac-os
|
||||
run: dotnet publish src/StreamShorts.Console/StreamsShorts.Console.csproj -c Release -r osx-x64 -o dist/mac-os
|
||||
- name: Rename mac-os file
|
||||
run: mv dist/mac-os/StreamShorts.Console dist/mac-os/StreamShorts.Console_macos
|
||||
- name: Publish for linux-os
|
||||
run: dotnet publish src/StreamShorts.Console/StreamShorts.Console.csproj -c Release -r linux-x64 -o dist/linux-os
|
||||
- name: Rename linux-os file
|
||||
run: mv dist/linux-os/StreamShorts.Console dist/linux-os/StreamShorts.Console_linux
|
||||
- name: Publish for windows-os
|
||||
run: dotnet publish src/StreamShorts.Console/StreamShorts.Console.csproj -c Release -r win-x64 -o dist/windows-os
|
||||
- name: Rename windows-os file
|
||||
run: mv dist/windows-os/StreamShorts.Console.exe dist/windows-os/StreamShorts.Console_windows.exe
|
||||
- name: Get project version
|
||||
uses: kzrnm/get-net-sdk-project-versions-action@v1
|
||||
id: get-version
|
||||
with:
|
||||
proj-path: src/StreamShorts.Console/StreamShorts.Console.csproj
|
||||
- name: Download changlog
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: change-log
|
||||
path: src/StreamShorts.Console
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
name: StreamShorts.Console v${{ steps.get-version.outputs.version }}
|
||||
tag_name: v${{ steps.get-version.outputs.version }}
|
||||
draft: false
|
||||
body_path: src/StreamShorts.Console/CHANGELOG.md
|
||||
files: |
|
||||
dist/mac-os/StreamShorts.Console_macos
|
||||
dist/linux-os/StreamShorts.Console_linux
|
||||
dist/windows-os/StreamShorts.Console_windows.exe
|
||||
Reference in New Issue
Block a user