Skip to content

Commit 7babece

Browse files
ci: consolidate per-platform release workflow into main release workflow (#100)
Add linux-arm64 build support and switch to per-platform zip artifacts, removing the redundant release-datadog-serverless-compat-per-platform.yml. Add publish.yml workflow to build and publish platform-specific npm packages (@datadog/serverless-compat-linux-x64, -linux-arm64, -win32-x64) with OIDC provenance. The release workflow is simplified to build and cut a draft GitHub release; packaging and npm publishing are fully owned by publish.yml.
1 parent 2bf0ba9 commit 7babece

5 files changed

Lines changed: 173 additions & 51 deletions

File tree

.github/workflows/publish.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Publish Datadog Serverless Compat NPM packages
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
publish:
7+
description: 'Build or Build and Publish?'
8+
required: true
9+
type: choice
10+
default: 'Build'
11+
options:
12+
- 'Build'
13+
- 'Build and Publish'
14+
version:
15+
description: 'NPM package version (x.y.z)'
16+
required: true
17+
type: string
18+
19+
permissions:
20+
id-token: write # For OIDC npm publishing with provenance
21+
22+
jobs:
23+
build:
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
runner: [ubuntu-24.04, ubuntu-24.04-arm, windows-2022]
28+
uses: ./.github/workflows/build-datadog-serverless-compat.yml
29+
with:
30+
runner: ${{ matrix.runner }}
31+
32+
package:
33+
runs-on: ubuntu-24.04
34+
needs: build
35+
steps:
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
with:
38+
sparse-checkout: npm
39+
sparse-checkout-cone-mode: false
40+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
41+
with:
42+
name: linux-amd64
43+
path: target/linux-amd64
44+
- run: |
45+
chmod +x target/linux-amd64/datadog-serverless-compat
46+
upx target/linux-amd64/datadog-serverless-compat --lzma
47+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
48+
with:
49+
name: linux-arm64
50+
path: target/linux-arm64
51+
- run: |
52+
chmod +x target/linux-arm64/datadog-serverless-compat
53+
upx target/linux-arm64/datadog-serverless-compat --lzma
54+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
55+
with:
56+
name: windows-amd64
57+
path: target/windows-amd64
58+
- run: upx target/windows-amd64/datadog-serverless-compat.exe --lzma
59+
- name: Package binaries into npm packages
60+
env:
61+
VERSION: ${{ inputs.version }}
62+
run: |
63+
mkdir -p npm/datadog-serverless-compat-linux-x64/bin
64+
cp target/linux-amd64/datadog-serverless-compat npm/datadog-serverless-compat-linux-x64/bin/
65+
npm --prefix npm/datadog-serverless-compat-linux-x64 pkg set version="$VERSION"
66+
67+
mkdir -p npm/datadog-serverless-compat-linux-arm64/bin
68+
cp target/linux-arm64/datadog-serverless-compat npm/datadog-serverless-compat-linux-arm64/bin/
69+
npm --prefix npm/datadog-serverless-compat-linux-arm64 pkg set version="$VERSION"
70+
71+
mkdir -p npm/datadog-serverless-compat-win32-x64/bin
72+
cp target/windows-amd64/datadog-serverless-compat.exe npm/datadog-serverless-compat-win32-x64/bin/
73+
npm --prefix npm/datadog-serverless-compat-win32-x64 pkg set version="$VERSION"
74+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
75+
with:
76+
name: npm-packages
77+
path: npm/
78+
retention-days: 3
79+
80+
publish:
81+
if: ${{ inputs.publish == 'Build and Publish' }}
82+
runs-on: ubuntu-24.04
83+
environment: Production
84+
needs: package
85+
steps:
86+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
87+
with:
88+
name: npm-packages
89+
path: npm/
90+
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
91+
with:
92+
node-version: "22.x"
93+
registry-url: 'https://registry.npmjs.org'
94+
- run: npm config set _authToken=$NPM_PUBLISH_TOKEN
95+
env:
96+
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
97+
- name: Publish npm packages
98+
run: |
99+
npm publish npm/datadog-serverless-compat-linux-x64 --provenance --access public
100+
npm publish npm/datadog-serverless-compat-linux-arm64 --provenance --access public
101+
npm publish npm/datadog-serverless-compat-win32-x64 --provenance --access public

.github/workflows/release-datadog-serverless-compat-per-platform.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@datadog/serverless-compat-linux-arm64",
3+
"version": "0.0.0",
4+
"description": "Linux arm64 binary for the Datadog Serverless Compatibility Layer",
5+
"os": [
6+
"linux"
7+
],
8+
"cpu": [
9+
"arm64"
10+
],
11+
"files": [
12+
"bin/"
13+
],
14+
"publishConfig": {
15+
"access": "public",
16+
"executableFiles": [
17+
"./bin/datadog-serverless-compat"
18+
]
19+
},
20+
"license": "Apache-2.0",
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/DataDog/serverless-components"
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@datadog/serverless-compat-linux-x64",
3+
"version": "0.0.0",
4+
"description": "Linux x64 binary for the Datadog Serverless Compatibility Layer",
5+
"os": [
6+
"linux"
7+
],
8+
"cpu": [
9+
"x64"
10+
],
11+
"files": [
12+
"bin/"
13+
],
14+
"publishConfig": {
15+
"access": "public",
16+
"executableFiles": [
17+
"./bin/datadog-serverless-compat"
18+
]
19+
},
20+
"license": "Apache-2.0",
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/DataDog/serverless-components"
24+
}
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@datadog/serverless-compat-win32-x64",
3+
"version": "0.0.0",
4+
"description": "Windows x64 binary for the Datadog Serverless Compatibility Layer",
5+
"os": [
6+
"win32"
7+
],
8+
"cpu": [
9+
"x64"
10+
],
11+
"files": [
12+
"bin/"
13+
],
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"license": "Apache-2.0",
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/DataDog/serverless-components"
21+
}
22+
}

0 commit comments

Comments
 (0)