Skip to content

Test Publish

Test Publish #38

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: create the release bash
shell: bash
run: |
echo "mytag=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# - name: create the release win-powershell
# continue-on-error: true
# run: |
# Add-Content -Path $env:GITHUB_ENV -Value "mytag=$(git rev-parse --short HEAD)"
- name: Build
shell: bash
run: |
echo "${{ env.mytag }}"
release_name="App-${{ env.mytag }}-${{ matrix.target }}"
# Build everything
dotnet publish StatusConsole/StatusConsole.csproj --framework net8.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*"
tag_name: "Rel_${{ env.mytag }}"
name: "Rel_${{ env.mytag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Create-Release
# id: release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: "Rel_${{ env.mytag }}"
# release_name: "Rel_${{ env.mytag }}"
# files: "App*"
# draft: false
# prerelease: false