Skip to content

Commit

Permalink
Updated to deploy pre-release packages from the PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Farshad DASHTI authored and Farshad DASHTI committed Dec 19, 2024
1 parent 3482ddc commit 4d01519
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nuget-package-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ jobs:
if [[ -z "$LATEST_VERSION" || "$LATEST_VERSION" == "null" ]]; then
echo "No existing version found in the feed. Defaulting to version 1.0.0"
NEW_VERSION="1.0.0"
NEW_VERSION="1.0.0${{ env.CUSTOM_SUFFIX }}"
else
echo "Latest version is $LATEST_VERSION"
IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_VERSION"
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$((VERSION_PARTS[2] + 1))"
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$((VERSION_PARTS[2] + 1))${{ env.CUSTOM_SUFFIX }}"
echo "Incrementing to new version: $NEW_VERSION"
fi
Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/pack-utilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@ on:

jobs:
build-and-package:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.event != 'pull_request' }}
uses: ./.github/workflows/nuget-package-template.yml
with:
project_name: DfE.CoreLibs.Utilities
project_path: src/DfE.CoreLibs.Utilities
nuget_package_name: DfE.CoreLibs.Utilities
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Set Pre-Release Suffix (if Pull Request)
id: set_suffix
run: |
if [[ "${{ github.event.workflow_run.event }}" == "pull_request" ]]; then
echo "This is a pull request. Setting suffix to '-beta'."
echo "CUSTOM_SUFFIX=-beta" >> $GITHUB_ENV
else
echo "This is not a pull request. No suffix needed."
echo "CUSTOM_SUFFIX=" >> $GITHUB_ENV
- name: Call NuGet Package Template
uses: ./.github/workflows/nuget-package-template.yml
with:
project_name: DfE.CoreLibs.Utilities
project_path: src/DfE.CoreLibs.Utilities
nuget_package_name: DfE.CoreLibs.Utilities
env:
CUSTOM_SUFFIX: ${{ env.CUSTOM_SUFFIX }}

0 comments on commit 4d01519

Please sign in to comment.