Skip to content

Commit 8f7ab82

Browse files
committed
chore: clean up whitespace in publish workflow for improved readability
1 parent b9bec51 commit 8f7ab82

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ jobs:
4343
workflow-path: ${{ steps.check-path.outputs.workflow-path }}
4444
version-bump: ${{ steps.check-path.outputs.version-bump }}
4545
npm-tag: ${{ steps.check-path.outputs.npm-tag }}
46-
46+
4747
steps:
4848
- name: Check out code
4949
uses: actions/checkout@v4
5050
with:
5151
fetch-depth: 2
52-
52+
5353
- name: Determine workflow path
5454
id: check-path
5555
run: |
@@ -58,15 +58,15 @@ jobs:
5858
SHOULD_BUILD="false"
5959
VERSION_BUMP="patch"
6060
NPM_TAG=""
61-
61+
6262
# Manual workflow dispatch
6363
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
6464
echo "🔵 Manual workflow trigger detected"
6565
WORKFLOW_PATH="manual"
6666
SHOULD_BUILD="true"
6767
VERSION_BUMP="${{ github.event.inputs.version_bump }}"
6868
NPM_TAG="${{ github.event.inputs.npm_tag }}"
69-
69+
7070
# Automatic triggers from push events
7171
elif [[ "${{ github.event_name }}" == "push" ]]; then
7272
# Check for version bump commit first
@@ -75,36 +75,36 @@ jobs:
7575
echo "🟢 Version bump commit detected!"
7676
WORKFLOW_PATH="version-bump"
7777
SHOULD_BUILD="true"
78-
78+
7979
if [[ "$COMMIT_MSG" == *"MINOR"* ]]; then
8080
echo "Minor version bump"
8181
VERSION_BUMP="minor"
8282
elif [[ "$COMMIT_MSG" == *"MAJOR"* ]]; then
8383
echo "Major version bump"
8484
VERSION_BUMP="major"
8585
fi
86-
86+
8787
# Next, check if any relevant files changed (matching the original path filters)
8888
elif git diff --name-only HEAD^ HEAD | grep -v "\.test\." | grep -q -E "(^\.browserslistrc$|^babel\.config\.|^src/)"; then
8989
echo "🟠 Relevant file changes detected"
9090
WORKFLOW_PATH="file-changes"
9191
SHOULD_BUILD="true"
92-
92+
9393
# No relevant changes - skip publishing
9494
else
9595
echo "⚪ No publishing-relevant changes detected"
9696
WORKFLOW_PATH="skip"
9797
fi
9898
fi
99-
99+
100100
# Set outputs for downstream jobs
101101
echo "workflow-path=$WORKFLOW_PATH" >> $GITHUB_OUTPUT
102102
echo "should-build=$SHOULD_BUILD" >> $GITHUB_OUTPUT
103103
echo "version-bump=$VERSION_BUMP" >> $GITHUB_OUTPUT
104104
echo "npm-tag=$NPM_TAG" >> $GITHUB_OUTPUT
105-
105+
106106
# Summary for logs
107-
echo "==========================================="
107+
echo "==========================================="
108108
echo "Workflow Path: $WORKFLOW_PATH"
109109
echo "Should Build: $SHOULD_BUILD"
110110
echo "Version Bump: $VERSION_BUMP"
@@ -196,37 +196,37 @@ jobs:
196196
registry-url: https://registry.npmjs.org
197197
scope: '@defra'
198198

199-
- name: Determine version bump details
199+
- name: Determine version bump details
200200
id: version-details
201201
run: |
202202
BRANCH_NAME="${{ github.ref_name }}"
203203
VERSION_TYPE="${{ needs.determine-path.outputs.version-bump }}"
204-
204+
205205
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
206-
206+
207207
# Check for invalid version bumps on release branches
208208
if [[ "$BRANCH_NAME" =~ release/v([0-9]+) ]]; then
209209
MAJOR_VERSION="${BASH_REMATCH[1]}"
210-
210+
211211
# Fail if a major bump was requested on a release branch
212212
if [[ "$VERSION_TYPE" == "major" ]]; then
213213
echo "::error::⛔ MAJOR VERSION BUMP NOT ALLOWED ON RELEASE BRANCH"
214214
echo "::error::Branch release/v${MAJOR_VERSION} is locked to major version ${MAJOR_VERSION}."
215215
echo "::error::To publish a new major version, create a new branch named release/v$((MAJOR_VERSION+1))."
216216
exit 1
217217
fi
218-
218+
219219
# Set the package version to match the major version if needed
220220
CURRENT_VERSION=$(npm pkg get version | tr -d \")
221221
CURRENT_MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
222-
222+
223223
if [[ "$CURRENT_MAJOR" != "$MAJOR_VERSION" ]]; then
224224
echo "::error::🚫 Major version mismatch: package.json version $CURRENT_VERSION does not match release/v${MAJOR_VERSION} branch."
225225
echo "::error::Please update the package.json manually to match major version ${MAJOR_VERSION}, or rename the branch if you intended a different major."
226226
exit 1
227227
fi
228228
fi
229-
229+
230230
echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
231231
232232
- name: Update package version
@@ -246,7 +246,7 @@ jobs:
246246
# Fix redundant variable assignment
247247
NEW_VERSION=$(npm pkg get version | tr -d \")
248248
PUBLISH_ARGS="--access public"
249-
249+
250250
# First priority: Check for custom tag from inputs
251251
if [[ -n "${{ needs.determine-path.outputs.npm-tag }}" ]]; then
252252
DIST_TAG="${{ needs.determine-path.outputs.npm-tag }}"
@@ -269,7 +269,7 @@ jobs:
269269
fi
270270
echo "Branch $BRANCH_NAME doesn't match expected patterns, using default publishing"
271271
fi
272-
272+
273273
# Add dry-run flag if specified (for manual workflow)
274274
if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then
275275
PUBLISH_ARGS="$PUBLISH_ARGS --dry-run"
@@ -279,7 +279,7 @@ jobs:
279279
# Temporary safety measure for testing
280280
# PUBLISH_ARGS="$PUBLISH_ARGS --dry-run"
281281
# echo "⚠️ TEST MODE: Force using --dry-run flag. Remove before merging to main! ⚠️"
282-
282+
283283
# Execute npm publish with all arguments
284284
npm publish $PUBLISH_ARGS
285285
env:

0 commit comments

Comments
 (0)