@@ -56,14 +56,20 @@ build:
56
56
build_artifacts :
57
57
stage : build
58
58
only :
59
- - /^v[0-9]+\..* /
59
+ - /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$ /
60
60
artifacts :
61
61
paths :
62
62
- artifacts/
63
63
script :
64
64
- if [ ! -d "artifacts" ]; then mkdir artifacts; fi
65
65
- 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
67
73
68
74
# complete artifacts & checksums
69
75
- cp packages/*/dist/artifacts/* artifacts/
@@ -85,12 +91,21 @@ release_npm:
85
91
- artifacts/
86
92
stage : release
87
93
only :
88
- - /^v[0-9]+\..* /
94
+ - /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$ /
89
95
script :
90
- # release to NPM
96
+ # Authenticate to NPM
91
97
- 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
94
109
- rm -f ~/.npmrc
95
110
96
111
release_github :
@@ -99,28 +114,33 @@ release_github:
99
114
- artifacts/
100
115
stage : release
101
116
only :
102
- - /^v[0-9]+\..* /
117
+ - /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$ /
103
118
script :
119
+ # Install GitHub CLI
104
120
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 23F3D4EA75716059
105
121
- 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
106
122
- sudo apt update
107
123
- sudo apt install gh
108
124
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
111
131
112
132
release_cdn :
113
133
artifacts :
114
134
paths :
115
135
- artifacts/
116
136
stage : release
117
137
only :
118
- - /^v[0-9]+\..* /
138
+ - /^v[0-9]+\.[0-9]+\.[0-9]+(-beta\.[0-9]+)?$ /
119
139
needs : ['release_github']
120
140
id_tokens :
121
141
CI_JOB_JWT :
122
142
aud : $CICD_VAULT_ADDR
123
143
script :
124
- # authenticate and release to CDN
144
+ # Authenticate and release to CDN
125
145
- creds-helper init && eval $(creds-helper aws --eval aws:v1/o11y-infra/role/o11y_gdi_otel_js_web_releaser_role)
126
146
- node scripts/release-cdn.mjs v${CI_COMMIT_REF_NAME:1}
0 commit comments