Skip to content

Commit 6d43f07

Browse files
committed
chore: distinguish beta and prod releases
1 parent df70732 commit 6d43f07

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

.gitlab-ci.yml

+31-11
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,20 @@ build:
5656
build_artifacts:
5757
stage: build
5858
only:
59-
- /^v[0-9]+\..*/
59+
- /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$/
6060
artifacts:
6161
paths:
6262
- artifacts/
6363
script:
6464
- if [ ! -d "artifacts" ]; then mkdir artifacts; fi
6565
- npm run compile
66-
- npm pack --pack-destination artifacts --workspace packages/session-recorder --workspace packages/web
66+
67+
# Check if the tag is a beta version
68+
- if [[ "$CI_COMMIT_TAG" =~ -beta\.[0-9]+$ ]]; then
69+
npm pack --tag beta --pack-destination artifacts --workspace packages/session-recorder --workspace packages/web;
70+
else
71+
npm pack --pack-destination artifacts --workspace packages/session-recorder --workspace packages/web;
72+
fi
6773

6874
# complete artifacts & checksums
6975
- cp packages/*/dist/artifacts/* artifacts/
@@ -85,12 +91,21 @@ release_npm:
8591
- artifacts/
8692
stage: release
8793
only:
88-
- /^v[0-9]+\..*/
94+
- /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$/
8995
script:
90-
# release to NPM
96+
# Authenticate to NPM
9197
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
92-
# January: remove --tag beta
93-
- for f in artifacts/*.tgz; do npm publish --tag beta ./$f; done;
98+
99+
# Publish to NPM with conditional tag
100+
- for f in artifacts/*.tgz; do
101+
if [[ "$CI_COMMIT_TAG" =~ -beta\.[0-9]+$ ]]; then
102+
npm publish --tag beta ./$f;
103+
else
104+
npm publish ./$f;
105+
fi;
106+
done;
107+
108+
# Clean up
94109
- rm -f ~/.npmrc
95110

96111
release_github:
@@ -99,28 +114,33 @@ release_github:
99114
- artifacts/
100115
stage: release
101116
only:
102-
- /^v[0-9]+\..*/
117+
- /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$/
103118
script:
119+
# Install GitHub CLI
104120
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 23F3D4EA75716059
105121
- echo "deb [arch=$(dpkg --print-architecture)] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
106122
- sudo apt update
107123
- sudo apt install gh
108124

109-
# January: remove --prerelease
110-
- gh release create v${CI_COMMIT_REF_NAME:1} ./artifacts/* --prerelease --target $CI_COMMIT_SHA --repo $GITHUB_REPOSITORY
125+
# Create GitHub release with conditional prerelease flag
126+
- if [[ "$CI_COMMIT_TAG" =~ -beta\.[0-9]+$ ]]; then
127+
gh release create v${CI_COMMIT_REF_NAME:1} ./artifacts/* --prerelease --target $CI_COMMIT_SHA --repo $GITHUB_REPOSITORY;
128+
else
129+
gh release create v${CI_COMMIT_REF_NAME:1} ./artifacts/* --target $CI_COMMIT_SHA --repo $GITHUB_REPOSITORY;
130+
fi
111131

112132
release_cdn:
113133
artifacts:
114134
paths:
115135
- artifacts/
116136
stage: release
117137
only:
118-
- /^v[0-9]+\..*/
138+
- /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$/
119139
needs: ['release_github']
120140
id_tokens:
121141
CI_JOB_JWT:
122142
aud: $CICD_VAULT_ADDR
123143
script:
124-
# authenticate and release to CDN
144+
# Authenticate and release to CDN
125145
- creds-helper init && eval $(creds-helper aws --eval aws:v1/o11y-infra/role/o11y_gdi_otel_js_web_releaser_role)
126146
- node scripts/release-cdn.mjs v${CI_COMMIT_REF_NAME:1}

0 commit comments

Comments
 (0)