Skip to content

Commit e5e826e

Browse files
authored
chore(ci): merge release workflow into one file (#6909)
1 parent ba308d4 commit e5e826e

File tree

5 files changed

+166
-184
lines changed

5 files changed

+166
-184
lines changed

.github/workflows/release-3.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/release-4.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/release-dev.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/release-latest.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
branches:
6+
- v3.x
7+
- v4.x
8+
- v5.x
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
publish-v3:
17+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/v3.x'
18+
runs-on: ubuntu-latest
19+
environment:
20+
name: npm
21+
url: https://npmjs.com/package/dd-trace
22+
permissions:
23+
id-token: write
24+
contents: write
25+
pull-requests: read
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
steps:
29+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
- uses: ./.github/actions/node
31+
- run: npm publish --tag latest-node14
32+
- id: pkg
33+
run: |
34+
content=`cat ./package.json | tr '\n' ' '`
35+
echo "json=$content" >> $GITHUB_OUTPUT
36+
- run: |
37+
git tag v${{ fromJson(steps.pkg.outputs.json).version }}
38+
git push origin v${{ fromJson(steps.pkg.outputs.json).version }}
39+
- run: node scripts/release/notes
40+
41+
publish-v4:
42+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/v4.x'
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: npm
46+
url: https://npmjs.com/package/dd-trace
47+
permissions:
48+
id-token: write
49+
contents: write
50+
pull-requests: read
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
steps:
54+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
55+
- uses: ./.github/actions/node
56+
- run: npm publish --tag latest-node16
57+
- id: pkg
58+
run: |
59+
content=`cat ./package.json | tr '\n' ' '`
60+
echo "json=$content" >> $GITHUB_OUTPUT
61+
- run: |
62+
git tag v${{ fromJson(steps.pkg.outputs.json).version }}
63+
git push origin v${{ fromJson(steps.pkg.outputs.json).version }}
64+
- run: node scripts/release/notes
65+
66+
publish-latest:
67+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/v5.x'
68+
runs-on: ubuntu-latest
69+
environment:
70+
name: npm
71+
url: https://npmjs.com/package/dd-trace
72+
permissions:
73+
id-token: write
74+
contents: write
75+
pull-requests: read
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
steps:
79+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
80+
- uses: ./.github/actions/node
81+
- run: npm publish
82+
- id: pkg
83+
run: |
84+
content=`cat ./package.json | tr '\n' ' '`
85+
echo "json=$content" >> $GITHUB_OUTPUT
86+
- run: |
87+
git tag v${{ fromJson(steps.pkg.outputs.json).version }}
88+
git push origin v${{ fromJson(steps.pkg.outputs.json).version }}
89+
- run: node scripts/release/notes --latest
90+
91+
docs:
92+
needs: 'publish-latest'
93+
runs-on: ubuntu-latest
94+
permissions:
95+
id-token: write
96+
contents: write
97+
steps:
98+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
99+
- uses: ./.github/actions/node
100+
- id: pkg
101+
run: |
102+
content=`cat ./package.json | tr '\n' ' '`
103+
echo "json=$content" >> $GITHUB_OUTPUT
104+
- run: yarn
105+
- name: Build
106+
working-directory: docs
107+
run: |
108+
yarn
109+
yarn build
110+
mv out /tmp/out
111+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
112+
with:
113+
ref: gh-pages
114+
- name: Deploy
115+
run: |
116+
rm -rf *
117+
mv /tmp/out/* .
118+
git config user.name github-actions
119+
git config user.email github-actions@github.com
120+
git add -A
121+
git commit -m ${{ fromJson(steps.pkg.outputs.json).version }}
122+
git push
123+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
124+
125+
publish-dev:
126+
if: github.event_name == 'workflow_dispatch'
127+
runs-on: ubuntu-latest
128+
environment:
129+
name: npm
130+
url: https://npmjs.com/package/dd-trace
131+
permissions:
132+
id-token: write
133+
contents: write
134+
steps:
135+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
136+
- uses: ./.github/actions/node
137+
- uses: ./.github/actions/install
138+
- id: pkg
139+
run: |
140+
content=`cat ./package.json | tr '\n' ' '`
141+
echo "json=$content" >> $GITHUB_OUTPUT
142+
- run: npm version --no-git-tag-version ${{ fromJson(steps.pkg.outputs.json).version }}-$(git rev-parse --short HEAD)+${{ github.run_id }}.${{ github.run_attempt }}
143+
- run: npm publish --tag dev
144+
- run: |
145+
git tag --force dev
146+
git push origin :refs/tags/dev
147+
git push origin --tags
148+
149+
status:
150+
needs: [
151+
'publish-v3',
152+
'publish-v4',
153+
'publish-latest',
154+
]
155+
if: always() && contains(needs.*.result, 'success')
156+
runs-on: ubuntu-latest
157+
permissions:
158+
id-token: write
159+
contents: read
160+
pull-requests: read
161+
env:
162+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163+
steps:
164+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
165+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
166+
- run: node scripts/release/status

0 commit comments

Comments
 (0)