Skip to content

Commit

Permalink
actions++
Browse files Browse the repository at this point in the history
  • Loading branch information
vpenades committed May 12, 2024
1 parent 6855de8 commit 0942c51
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 37 deletions.
35 changes: 3 additions & 32 deletions .github/workflows/BuildPackages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# --------------------------------------------- variables

- name: Define SemVer suffix
run: |
NUGETSEMVER="${{ inputs.nuget-semver }}"
# replace DATE
DATE_SHORT=$(date +'%Y%m%d')
if [[ "NUGETSEMVER" == *"$DATE"* ]]; then
NUGETSEMVER="${NUGETSEMVER/DATE/$DATE_SHORT}"
fi
# replace TIME
TIME_SHORT=$(date +'%H%M%S')
if [[ "NUGETSEMVER" == *"$TIME"* ]]; then
NUGETSEMVER="${NUGETSEMVER/TIME/$TIME_SHORT}"
fi
# emit env variable
echo "DOTNET_NUGETSEMVER=$NUGETSEMVER" >> $GITHUB_ENV
echo ${{ env.DOTNET_NUGETSEMVER }}
# --------------------------------------------- build

- name: Install tools
run: dotnet tool restore

- name: Install dependencies
run: dotnet restore

- name: Build
run: dotnet build -c Release /p:Version=${{ env.DOTNET_NUGETSEMVER }}

- name: Pack
run: dotnet pack -c Release --no-build --output "."
run: |
chmod +x build.sh
build.sh $nuget-semver
# --------------------------------------------- publish

Expand Down
22 changes: 22 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# set input or default

DEFAULTSEMVER="1.0.0-Test-DATE-TIME"
NUGETSEMVER=${1:-$DEFAULTSEMVER}

# replace date
DATE_SHORT=$(date +'%Y%m%d')
NUGETSEMVER="${NUGETSEMVER/DATE/$DATE_SHORT}"

# replace time
TIME_SHORT=$(date +'%H%M%S')
NUGETSEMVER="${NUGETSEMVER/TIME/$TIME_SHORT}"

# report semver
echo "Semver: $NUGETSEMVER";

# build

dotnet restore

dotnet pack -c Release --output "." -p:PackageVersion=$NUGETSEMVER
5 changes: 0 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@
<PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<VersionPrefix>1.0.0</VersionPrefix>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Deterministic>true</Deterministic>
Expand Down

0 comments on commit 0942c51

Please sign in to comment.