Skip to content

Commit 81ce60e

Browse files
authored
Revert release and add Publish job to v2 (#2332)
* Revert "Prepare for v2 releases batch 1 (#2331)" This reverts commit 28c0fa1. * Add publish job
1 parent 28c0fa1 commit 81ce60e

File tree

3 files changed

+53
-3
lines changed

3 files changed

+53
-3
lines changed

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish package on NPM
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
release:
8+
types:
9+
- prereleased
10+
- released
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
with:
17+
fetch-depth: 1
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
- name: Releasing tag ${{ github.event.release.tag_name }}
22+
run: |
23+
corepack enable; yarn
24+
25+
# Get tag name from event
26+
tag_name="${{ github.event.release.tag_name }}"
27+
28+
if [[ ! "$tag_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
29+
cd $(echo $tag_name | rev | cut -d'/' -f2- | rev)
30+
fi
31+
32+
yarn_major_version=$(yarn --version | cut -d'.' -f1)
33+
if [ "$yarn_major_version" -ge 2 ] && [ "$yarn_major_version" -le 4 ]; then
34+
cmd="yarn npm publish --access public"
35+
elif [ "$yarn_major_version" -eq 1 ]; then
36+
cmd="yarn publish --access public"
37+
else
38+
echo "Unsupported Yarn version: $yarn_major_version"
39+
exit 1
40+
fi
41+
42+
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
43+
cmd+=" --tag=beta"
44+
else
45+
cmd+=" --tag=latest"
46+
fi
47+
48+
eval $cmd
49+
env:
50+
NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
51+
YARN_NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
52+
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
# CHANGELOG
2-
3-
## 2.0.0-beta.1/2025-06-05

packages/datadog-api-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
"engines": {
4646
"node": ">=18.0.0"
4747
},
48-
"version": "2.0.0-beta.1",
48+
"version": "2.0.0-beta.0",
4949
"packageManager": "[email protected]"
5050
}

0 commit comments

Comments
 (0)