Skip to content

MyPublish

MyPublish #30

Workflow file for this run

# Many Thanks to PATRIK SVENSSON for this excelent 'template' !!!
# see : https://patriksvensson.se/2020/03/creating-release-artifacts-with-github-actions
name: MyPublish
on:
release:
types: [published]
pull_request:
branches:
- master
types:
- closed
workflow_dispatch:
jobs:
release:
# if: github.event.pull_request.merged == true
name: Release
strategy:
matrix:
kind: ['linux', 'windows']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
options: /p:PublishSingleFile=true
- kind: windows
os: windows-latest
target: win-x64
options: //p:PublishSingleFile=true
# - kind: macOS
# os: macos-latest
# target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
shell: bash
run: |
echo "tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
release_name="App-$tag-${{ matrix.target }}"
# Build everything
dotnet publish StatusConsole/StatusConsole.csproj --framework net7.0 --self-contained --runtime "${{ matrix.target }}" -c Release -o "$release_name" "${{ matrix.options }}"
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "App*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}