Skip to content

add zipping update linux #35

add zipping update linux

add zipping update linux #35

Workflow file for this run

name: Publish NuGet Packages
on:
push:
tags:
- "v*.*.*"
env:
Project_Name: Consequences/Consequences.csproj
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.x'
- name: Create version number
shell: pwsh
run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
$VERSION = $TAG -replace '^v', ''
echo "VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build for Windows x64
run: dotnet publish ${{ env.PROJECT_NAME }} -c Release -r win-x64 --self-contained -p:PublishAot=true /p:PackageVersion=${{ env.VERSION }}
- name: Pack NuGet packages
run: dotnet pack ${{ env.PROJECT_NAME }} -c Release /p:PackageVersion=${{ env.VERSION }}
- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push **/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
- name: Upload Windows build artifact
uses: actions/upload-artifact@v4
with:
name: USACE.HEC.Consequences-${{ env.VERSION }}-windows-x64
path: ./Consequences/bin/Release/net8.0/win-x64/native/
- name: Print all file paths
shell: pwsh
run: |
$root_path = Get-Location
Get-ChildItem -Path $root_path -Recurse | Where-Object {!$_.PSIsContainer} | ForEach-Object {
$_.FullName.Replace("$root_path\", "")
}
- name: Zip Release Package
shell: pwsh
run: |
$root_path = Get-Location
Compress-Archive -Path $root_path/Consequences/bin/Release/net8.0/win-x64/native/ -DestinationPath $root_path/Consequences/bin/Release/net8.0/win-x64/native/USACE.HEC.Consequences-${env:VERSION}-windows-x64.zip
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
$root_path/Consequences/bin/Release/net8.0/win-x64/native/USACE.HEC.Consequences-${env:VERSION}-windows-x64.zip
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.x'
- name: Create version number
shell: bash
run: |
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#v}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build for Linux x64
run: dotnet publish ${{ env.PROJECT_NAME }} -c Release -r linux-x64 --self-contained -p:PublishAot=true /p:PackageVersion=${{ env.VERSION }}
- name: Pack NuGet packages
run: dotnet pack ${{ env.PROJECT_NAME }} -c Release /p:PackageVersion=${{ env.VERSION }}
- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push **/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
- name: Upload Linux build artifact
uses: actions/upload-artifact@v4
with:
name: USACE.HEC.Consequences-${{ env.VERSION }}-linux-x64
path: ./Consequences/bin/Release/net8.0/linux-x64/native/
- name: Print all file paths
shell: bash
run: |
find $(pwd) -type f | sed "s|$(pwd)/||"
- name: Zip Release Package
shell: bash
run: |
zip -r ./Consequences/bin/Release/net8.0/linux-x64/native/USACE.HEC.Consequences-${env:VERSION}-linux-x64.zip ./Consequences/bin/Release/net8.0/linux-x64/native/