Skip to content

Commit 43e23b9

Browse files
committed
chore(ci): fix alpha versioning pre-release
1 parent a6942b4 commit 43e23b9

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Diff for: .github/actions/cached-node-modules/action.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
nodeVersion: # id of input
55
description: 'Node.js version to use in the cache key'
66
default: '20'
7+
build:
8+
description: 'Whether to build the packages or not'
9+
default: 'true'
710
outputs:
811
cache-hit:
912
description: "Whether the cache was hit or not"
@@ -29,8 +32,8 @@ runs:
2932
run: npm ci
3033
shell: bash
3134
- name: Build packages
32-
# Regardless of whether the cache was hit or not, we need to build the packages.
33-
#
35+
# Regardless of whether the cache was hit or not, we need to build the packages, unless the caller says otherwise
36+
if: inputs.build == 'true'
3437
# We build the shared package first, then the others in parallel to speed up the process
3538
# even though we could just run `npm run build` in the root folder and build them in
3639
# sequence, but still in the correct order.

Diff for: .github/workflows/make-v2-release.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
3434
- name: Setup dependencies
3535
uses: ./.github/actions/cached-node-modules
36+
with:
37+
# We don't build the packages here as we want to version them first
38+
build: false
3639
- name: Version
3740
run: |
3841
# Version all packages to next major version (2.0.0) without pushing to git, generating changelog or running commit hooks
@@ -41,17 +44,17 @@ jobs:
4144
- name: Set alpha iteration
4245
run: |
4346
# Get the current alpha version from npm i.e 2.0.0-alpha.0 -> 0, 2.0.0-alpha.1 -> 1 (default to -1 if no alpha versions exist = first pre-release)
44-
ITERATION=$(npm show @aws-lambda-powertools/commons time --json | jq -r 'to_entries | map(select(.key | startswith("2.0.0-alpha"))) | sort_by(.key) | last | .key // "-1"')
47+
ITERATION=$(npm show @aws-lambda-powertools/commons time --json | jq -r 'to_entries | map(select(.key | startswith("2.0.0-alpha"))) | sort_by(.key) | last | .key // "-1"' | cut -d '.' -f 4)
4548
# Write the new version to the file
4649
echo "{ \"iteration\": $((ITERATION + 1)) }" > v2.json
4750
- name: Increment version in UA
4851
run: |
4952
# Increment the version in the UA
50-
echo "// this file is auto generated, do not modify\nexport const PT_VERSION = '2.0.0-alpha.$(jq -r '.iteration' v2.json)';" > packages/commons/src/version.ts
53+
echo -e "// this file is auto generated, do not modify\nexport const PT_VERSION = '2.0.0-alpha.$(jq -r '.iteration' v2.json)';" > packages/commons/src/version.ts
5154
- name: Build
5255
run: |
56+
npm run build -w packages/commons &
5357
npm run build -w packages/batch \
54-
-w packages/commons \
5558
-w packages/idempotency \
5659
-w packages/logger \
5760
-w packages/metrics \

0 commit comments

Comments
 (0)