Skip to content

Commit

Permalink
actions++
Browse files Browse the repository at this point in the history
  • Loading branch information
vpenades committed May 11, 2024
1 parent 2c933d6 commit 7fa65f8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/BuildPackages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ on:

workflow_dispatch:
inputs:
version-suffix:
package-version:
type: string
description: 'semver version suffix'
description: 'package version'
required: false
default: 'Test-DATE-TIME'
default: '1.0.0-Test-DATE-TIME'

workflow_call:
inputs:
version-suffix:
package-version:
type: string
description: 'semver version suffix'
description: 'package version'
required: true
default: 'Test-DATE-TIME'
default: '1.0.0-Test-DATE-TIME'

jobs:
build_job:
Expand All @@ -40,23 +40,23 @@ jobs:

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

Expand All @@ -67,7 +67,7 @@ jobs:
run: dotnet restore

- name: Build
run: dotnet build -c Release --version-suffix ${{ env.SEMVERSUFFIX }}
run: dotnet build -c Release /p:Version=1.0.0-${{ env.PACKAGEVERSION }}

- name: Pack
run: dotnet pack -c Release --no-build --output "."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PublishToGithub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build_job:
uses: ./.github/workflows/BuildPackages.yml
with:
version-suffix: Preview-DATE
package-version: 1.0.0-Preview-DATE

publish_job:
needs: build_job
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PublishToNuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build_job:
uses: ./.github/workflows/BuildPackages.yml
with:
version-suffix: alpha${{ vars.SharpGLTF_AlphaVersion }}
package-version: 1.0.0-alpha${{ vars.SharpGLTF_AlphaVersion }}

publish_job:
needs: build_job
Expand Down

0 comments on commit 7fa65f8

Please sign in to comment.