Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
seedysoft committed Apr 30, 2024
1 parent 12e7c94 commit b3f3c7a
Showing 1 changed file with 36 additions and 43 deletions.
79 changes: 36 additions & 43 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,65 @@ defaults:
shell: bash

on:
push:
branches:
- $default-branch
pull_request:
branches:
- $default-branch
- main
push:
branches:
- main
tags:
- "*"
workflow_dispatch:

jobs:
build:
name: Build
runs-on: [SWIFT-SF514-55T, ubuntu-latest]
strategy:
matrix:
kind: ["linux", "windows"]
include:
- kind: linux
os: ubuntu-latest
target: linux-arm64
- kind: windows
os: windows-latest
target: win-x64
runs-on: [ubuntu-latest]

steps:
- name: Name release
id: name-release
run: |
echo "release_name=$(printf '%(%Y.%m.%d)T\n' -1)" >> $GITHUB_OUTPUT
- name: Checkout Code
id: checkout-code
uses: actions/checkout@main
with:
fetch-depth: 0
run: echo "Running ${{ github.job }}"

- name: Setup .NET
id: setup-dotnet
uses: actions/setup-dotnet@main
with:
dotnet-version: 8.0.x
run: echo "Running ${{ github.job }}"
- name: Restore dependencies
id: restore-dependencies
run: |
echo "Running ${{ github.job }}"
# Restore everything
dotnet restore Seedysoft.sln verbosity normal
- name: Build solution
id: build-solution

- name: Publish linux-arm64 runtime
id: publish-linux-arm64-runtime
run: |
echo "Running ${{ github.job }}"
# Build everything
dotnet build Seedysoft.sln no-restore --verbosity normal
- name: Publish solution
id: publish-solution
# Publish
dotnet publish Seedysoft.sln -c Release -r linux-arm64 -p:BlazorCacheBootResources=false -p:PublishTrimmed=false --sc --verbosity normal -o ${{ steps.name-release.outputs.release_name }}
# Pack files
tar czvf "${{ github.ref_name }}.tar.gz" "${{ steps.name-release.outputs.release_name }}"
# Delete output directory
rm -r "${{ steps.name-release.outputs.release_name }}"
- name: Publish win-x64 runtime
id: publish-win-x64-runtime
run: |
echo "Running ${{ github.job }}"
# Publish everything
dotnet publish Seedysoft.sln -c Release -r "${{ matrix.target }}" -p:BlazorCacheBootResources=false -p:PublishTrimmed=false --sc --verbosity normal
# Publish
dotnet publish Seedysoft.sln -c Release -r win-x64 -p:BlazorCacheBootResources=false -p:PublishTrimmed=false --sc --verbosity normal -o ${{ steps.name-release.outputs.release_name }}
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
# Pack to tar elsewhere
tar czvf "${release_name}.tar.gz" "$release_name"
fi
7z a -tzip "${{ github.ref_name }}.zip" "./${{ steps.name-release.outputs.release_name }}/*"
# Delete output directory
rm -r "$release_name"
rm -r "${{ steps.name-release.outputs.release_name }}"
- name: Make Release
id: make-release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
run: |
echo "Running ${{ github.job }}"
name: Release ${{ github.ref_name }}
files: |
"${{ github.ref_name }}.tar.gz"
"${{ github.ref_name }}.zip"

0 comments on commit b3f3c7a

Please sign in to comment.