Skip to content

Commit 6e5fe5f

Browse files
author
Jani Giannoudis
committed
ci: rewrite PE dependency versions before restore
1 parent de1dbd4 commit 6e5fe5f

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ jobs:
4040
IS_PRERELEASE="false"
4141
fi
4242
fi
43-
4443
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4544
echo "is_prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
4645
echo "dry_run=${DRY_RUN}" >> $GITHUB_OUTPUT
47-
4846
if [ "${DRY_RUN}" = "true" ]; then
4947
echo "make_draft=true" >> $GITHUB_OUTPUT
5048
else
@@ -68,36 +66,24 @@ jobs:
6866
const owner = context.repo.owner;
6967
const repo = context.repo.repo;
7068
const errors = [];
71-
7269
try {
7370
await github.rest.git.getRef({ owner, repo, ref: `tags/${tag}` });
7471
errors.push(`Git tag '${tag}' already exists`);
75-
} catch (e) {
76-
if (e.status !== 404) throw e;
77-
console.log(`✅ Git tag '${tag}' is available`);
78-
}
79-
72+
} catch (e) { if (e.status !== 404) throw e; }
8073
try {
8174
await github.rest.repos.getReleaseByTag({ owner, repo, tag });
8275
errors.push(`GitHub Release '${tag}' already exists`);
83-
} catch (e) {
84-
if (e.status !== 404) throw e;
85-
console.log(`✅ GitHub Release '${tag}' is available`);
86-
}
87-
76+
} catch (e) { if (e.status !== 404) throw e; }
8877
try {
8978
const packages = await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
9079
package_type: 'nuget', package_name: repo, org: owner
9180
});
9281
if (packages.data.some(p => p.name === version))
9382
errors.push(`NuGet package version '${version}' already exists on GitHub Packages`);
94-
else
95-
console.log(`✅ NuGet package version '${version}' is available`);
9683
} catch (e) {
9784
if (e.status === 404) console.log(`✅ No package found yet (first publish)`);
9885
else console.warn(`⚠️ Could not check packages: ${e.message}`);
9986
}
100-
10187
if (errors.length > 0)
10288
core.setFailed(`❌ Version guard failed:\n${errors.map(e => ` - ${e}`).join('\n')}`);
10389
else
@@ -109,17 +95,16 @@ jobs:
10995
run: |
11096
CURRENT=$(grep -oP '(?<=<Version>)[^<]+' Directory.Build.props)
11197
echo "version=${CURRENT}" >> $GITHUB_OUTPUT
112-
echo "📋 Current version in Directory.Build.props: ${CURRENT}"
11398
11499
- name: Update Directory.Build.props
115100
run: |
116101
VERSION="${{ steps.params.outputs.version }}"
117102
CURRENT="${{ steps.current.outputs.version }}"
118103
if [ "${VERSION}" = "${CURRENT}" ]; then
119-
echo "ℹ️ Version already set to ${VERSION}, no change needed"
104+
echo "ℹ️ Version already set to ${VERSION}"
120105
else
121106
sed -i "s|<Version>${CURRENT}</Version>|<Version>${VERSION}</Version>|" Directory.Build.props
122-
echo "✅ Updated Directory.Build.props: ${CURRENT} → ${VERSION}"
107+
echo "✅ Updated: ${CURRENT} → ${VERSION}"
123108
fi
124109
grep '<Version>' Directory.Build.props
125110
@@ -131,14 +116,21 @@ jobs:
131116
git config user.email "github-actions[bot]@users.noreply.github.com"
132117
git add Directory.Build.props
133118
if git diff --cached --quiet; then
134-
echo "ℹ️ No changes to commit (version was already correct)"
119+
echo "ℹ️ No changes to commit"
135120
else
136121
git commit -m "release: v${VERSION}"
137122
git push
138-
echo "✅ Version bump committed and pushed"
139123
fi
140124
141125
# ── Build ────────────────────────────────────────
126+
- name: Update PE dependency versions
127+
run: |
128+
VERSION="${{ steps.params.outputs.version }}"
129+
find . -name "*.csproj" | xargs sed -i -E \
130+
"s|(<PackageReference Include=\"PayrollEngine\.[^\"]*\" Version=\")[^\"]*\"|\1${VERSION}\"|g"
131+
echo "✅ PE dependencies updated to ${VERSION}"
132+
grep -rh 'PayrollEngine\.' --include="*.csproj" | grep 'Version=' || true
133+
142134
- name: Setup .NET
143135
uses: actions/setup-dotnet@v4
144136
with:

0 commit comments

Comments
 (0)