-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (70 loc) · 2.55 KB
/
Release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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" >> $env:GITHUB_ENV
- name: Build for Windows x64
run: dotnet publish ${{ env.PROJECT_NAME }} -c Release -r win-x64 --self-contained -p:PublishAot=true /p:Version=${{ 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: Zip Release Package
shell: pwsh
run: |
$SOURCE_PATH ="${pwd}/Consequences/bin/Release/net8.0/win-x64/native/*"
$DEST_PATH = "${pwd}/USACE.HEC.Consequences-${{env.VERSION}}-windows-x64.zip"
Compress-Archive -Path $SOURCE_PATH -DestinationPath $DEST_PATH
echo "PACKAGE=$DEST_PATH" >> $env:GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PACKAGE }}
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:Version=${{ env.VERSION }}
- name: Zip Release Package
shell: bash
run: |
SRC_PATH="./Consequences/bin/Release/net8.0/linux-x64/native/"
PKG_NAME="USACE.HEC.Consequences-${{ env.VERSION }}-linux-x64.zip"
FULL_PKG="${SRC_PATH}${PKG_NAME}"
echo "FULL_PKG=${FULL_PKG}" >> $GITHUB_ENV
cd $SRC_PATH
zip $FULL_PKG ./*
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.FULL_PKG }}