Skip to content

Commit d1a3137

Browse files
committed
chore(ci): fix alpha versioning pre-release
1 parent 0ac3500 commit d1a3137

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: '18'
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"
@@ -28,8 +31,8 @@ runs:
2831
run: npm ci
2932
shell: bash
3033
- name: Build packages
31-
# Regardless of whether the cache was hit or not, we need to build the packages.
32-
#
34+
# Regardless of whether the cache was hit or not, we need to build the packages, unless the caller says otherwise
35+
if: inputs.build == 'true'
3336
# We build the shared package first, then the others in parallel to speed up the process
3437
# even though we could just run `npm run build` in the root folder and build them in
3538
# 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
@@ -28,6 +28,9 @@ jobs:
2828
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
2929
- name: Setup dependencies
3030
uses: ./.github/actions/cached-node-modules
31+
with:
32+
# We don't build the packages here as we want to version them first
33+
build: false
3134
- name: Version
3235
run: |
3336
# Version all packages to next major version (2.0.0) without pushing to git, generating changelog or running commit hooks
@@ -36,17 +39,17 @@ jobs:
3639
- name: Set alpha iteration
3740
run: |
3841
# 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)
39-
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"')
42+
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)
4043
# Write the new version to the file
4144
echo "{ \"iteration\": $((ITERATION + 1)) }" > v2.json
4245
- name: Increment version in UA
4346
run: |
4447
# Increment the version in the UA
45-
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
48+
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
4649
- name: Build
4750
run: |
51+
npm run build -w packages/commons &
4852
npm run build -w packages/batch \
49-
-w packages/commons \
5053
-w packages/idempotency \
5154
-w packages/logger \
5255
-w packages/metrics \

0 commit comments

Comments
 (0)