Skip to content

Commit 84ce010

Browse files
Update create-release.yml
needed to account for different branches when using shared-workflows
1 parent b1aa6f4 commit 84ce010

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

.github/workflows/create-release.yml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,74 +17,83 @@ on:
1717
required: true
1818

1919
permissions:
20-
contents: write
20+
contents: write
2121
pull-requests: write
22-
packages: write
22+
packages: write
2323

2424
jobs:
2525
validate_branch:
2626
runs-on: ubuntu-latest
27-
28-
2927
outputs:
3028
version_json_path: ${{ steps.locate_version.outputs.file }}
31-
3229
steps:
3330
- name: Checkout target branch
3431
uses: actions/checkout@v4
3532
with:
3633
fetch-depth: 1
3734
ref: ${{ inputs.target_branch }}
3835

39-
# Optional sanity check (keeps the job obvious when the ref is wrong)
4036
- name: Ensure target branch exists
4137
run: |
4238
if ! git rev-parse --verify --quiet "refs/heads/${{ inputs.target_branch }}"; then
4339
echo "::error::Ref '${{ inputs.target_branch }}' not found."
4440
exit 1
4541
fi
4642
47-
# Find version.json and emit its absolute path
4843
- name: Locate version.json
4944
id: locate_version
5045
shell: bash
5146
run: |
52-
# Search Git-tracked files first …
5347
REL_PATH=$(git ls-files --full-name '*version.json' | head -n1)
54-
55-
# … fall back to a filesystem search for untracked files (optional)
5648
if [[ -z "$REL_PATH" ]]; then
5749
REL_PATH=$(find . -type f -name version.json | head -n1 | sed 's|^\./||')
5850
fi
59-
6051
if [[ -z "$REL_PATH" ]]; then
6152
echo "::error::version.json not found on branch '${{ inputs.target_branch }}'."
62-
tree -L 2 -C || true
6353
exit 1
6454
fi
55+
echo "file=$GITHUB_WORKSPACE/$REL_PATH" >> "$GITHUB_OUTPUT"
6556
66-
ABS_PATH="$GITHUB_WORKSPACE/$REL_PATH"
67-
echo "Found version.json at: $ABS_PATH"
68-
69-
# Pass the path to other jobs
70-
echo "file=$ABS_PATH" >> "$GITHUB_OUTPUT"
71-
72-
prepare:
57+
prepare-main:
7358
needs: validate_branch
59+
if: ${{ inputs.target_branch == 'main' || inputs.target_branch == 'master' }}
7460
uses: Stillpoint-Software/shared-workflows/.github/workflows/nbgv_prepare_release.yml@main
7561
with:
7662
target_branch: ${{ inputs.target_branch }}
7763
increment: ${{ inputs.increment }}
7864
version_file_path: ${{ needs.validate_branch.outputs.version_json_path }}
7965
secrets: inherit
8066

81-
publish:
82-
needs: prepare
67+
prepare-develop:
68+
needs: validate_branch
69+
if: ${{ inputs.target_branch == 'develop' }}
70+
uses: Stillpoint-Software/shared-workflows/.github/workflows/nbgv_prepare_release.yml@develop
71+
with:
72+
target_branch: ${{ inputs.target_branch }}
73+
increment: ${{ inputs.increment }}
74+
version_file_path: ${{ needs.validate_branch.outputs.version_json_path }}
75+
secrets: inherit
76+
77+
publish-main:
78+
needs: prepare-main
79+
if: ${{ inputs.target_branch == 'main' || inputs.target_branch == 'master' }}
8380
uses: Stillpoint-Software/shared-workflows/.github/workflows/nbgv_dotnet_pack.yml@main
8481
with:
85-
checkout_ref: ${{ needs.prepare.outputs.release_branch }}
86-
build_configuration: ${{ inputs.target_branch == 'develop' && 'Develop' || 'Release' }}
82+
checkout_ref: ${{ needs.prepare-main.outputs.release_branch }}
83+
build_configuration: Release
84+
push_after_pack: true
85+
force_dev_prerelease: false
86+
secrets:
87+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
88+
89+
publish-develop:
90+
needs: prepare-develop
91+
if: ${{ inputs.target_branch == 'develop' }}
92+
uses: Stillpoint-Software/shared-workflows/.github/workflows/nbgv_dotnet_pack.yml@develop
93+
with:
94+
checkout_ref: ${{ needs.prepare-develop.outputs.release_branch }}
95+
build_configuration: Develop
8796
push_after_pack: true
88-
force_dev_prerelease: ${{ inputs.target_branch == 'develop' }}
97+
force_dev_prerelease: true
8998
secrets:
9099
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)