Skip to content

Commit 58f9aae

Browse files
authored
Merge pull request #224 from IABTechLab/xuy-UID2-6234-move-release-pipeline
Xuy UI d2 6234 move release pipeline
2 parents 438d81b + d144ff9 commit 58f9aae

File tree

2 files changed

+213
-0
lines changed

2 files changed

+213
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build SDK Package
2+
run-name: ${{ inputs.release_type == 'Snapshot' && 'Build Pre-release' || format('Build {0}', inputs.release_type)}} SDK Package by @${{ github.actor }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
release_type:
8+
type: choice
9+
description: The type of release
10+
options:
11+
- Major
12+
- Minor
13+
- Patch
14+
- Snapshot
15+
required: true
16+
17+
jobs:
18+
incrementVersionNumber:
19+
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2
20+
with:
21+
release_type: ${{ inputs.release_type }}
22+
secrets: inherit
23+
24+
build:
25+
runs-on: ubuntu-latest
26+
needs: [incrementVersionNumber]
27+
strategy:
28+
matrix:
29+
node-version: [20.x]
30+
target: [development, production]
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
ref: ${{ needs.incrementVersionNumber.outputs.git_tag_or_hash }}
35+
- name: Use Node.js ${{ matrix.node-version }}
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
- name: Get Package Version
40+
id: version
41+
run: |
42+
echo "package_version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
43+
- name: Install dependencies
44+
run: npm install
45+
- name: Build SDK for CDN
46+
run: npm run build -- --mode=${{ matrix.target }}
47+
- name: Build NPM Package
48+
if: matrix.target == 'production'
49+
run: npm run build-package
50+
51+
# Upload SDK artifacts for CDN
52+
- name: Upload UID2 SDK artifact
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: uid2SDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }}
56+
path: ./dist/uid2-sdk-${{ steps.version.outputs.package_version }}.js
57+
retention-days: 30
58+
59+
- name: Upload EUID SDK artifact
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: euidSDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }}
63+
path: ./dist/euid-sdk-${{ steps.version.outputs.package_version }}.js
64+
retention-days: 30
65+
66+
# Upload NPM package artifacts
67+
- name: Upload UID2 NPM package
68+
if: matrix.target == 'production'
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: uid2-npm-package-${{ steps.version.outputs.package_version }}
72+
path: ./dist/uid2-npm/
73+
retention-days: 30
74+
75+
- name: Upload EUID NPM package
76+
if: matrix.target == 'production'
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: euid-npm-package-${{ steps.version.outputs.package_version }}
80+
path: ./dist/euid-npm/
81+
retention-days: 30
82+
83+
outputs:
84+
sdkVersion: ${{ steps.version.outputs.package_version }}
85+
git_tag: ${{ needs.incrementVersionNumber.outputs.git_tag_or_hash }}
86+
new_version: ${{ needs.incrementVersionNumber.outputs.new_version }}
87+
88+
createNpmJsRelease:
89+
needs: [incrementVersionNumber, build]
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Build Changelog
93+
id: github_release_changelog
94+
uses: mikepenz/release-changelog-builder-action@v4
95+
with:
96+
toTag: v${{ needs.incrementVersionNumber.outputs.new_version }}
97+
configurationJson: |
98+
{
99+
"pr_template": " - #{{TITLE}} - ( PR: ##{{NUMBER}} )"
100+
}
101+
- name: Create Release Notes
102+
uses: softprops/action-gh-release@v2
103+
with:
104+
name: v${{ needs.incrementVersionNumber.outputs.new_version }}
105+
body: ${{ steps.github_release_changelog.outputs.changelog }}
106+
draft: true
107+
108+
build-summary:
109+
needs: [build, incrementVersionNumber]
110+
runs-on: ubuntu-latest
111+
steps:
112+
- name: Build Summary
113+
run: |
114+
echo "## Build Complete! 🎉" >> $GITHUB_STEP_SUMMARY
115+
echo "" >> $GITHUB_STEP_SUMMARY
116+
echo "**Version:** ${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
117+
echo "**Git Tag:** ${{ needs.build.outputs.git_tag }}" >> $GITHUB_STEP_SUMMARY
118+
echo "" >> $GITHUB_STEP_SUMMARY
119+
echo "### Artifacts Built:" >> $GITHUB_STEP_SUMMARY
120+
echo "- ✅ uid2SDK-development-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
121+
echo "- ✅ uid2SDK-production-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
122+
echo "- ✅ euidSDK-development-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
123+
echo "- ✅ euidSDK-production-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
124+
echo "- ✅ uid2-npm-package-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
125+
echo "- ✅ euid-npm-package-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
126+
echo "" >> $GITHUB_STEP_SUMMARY
127+
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
128+
echo "Run the **Publish SDK Package** workflow in the private repo to deploy these artifacts." >> $GITHUB_STEP_SUMMARY
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build Secure Signal Package
2+
run-name: Build Secure Signal Package by @${{ github.actor }}
3+
4+
on:
5+
workflow_dispatch:
6+
7+
env:
8+
WORKING_DIR: ./
9+
10+
jobs:
11+
verify:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
uid2_modified: ${{ steps.verify_uid2.outputs.any_modified }}
15+
euid_modified: ${{ steps.verify_euid.outputs.any_modified }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Check for change to src/secureSignalUid2.ts
19+
id: verify_uid2
20+
uses: tj-actions/changed-files@v41
21+
with:
22+
files: src/secureSignalUid2.ts
23+
- name: Check for change to src/secureSignalEuid.ts
24+
id: verify_euid
25+
uses: tj-actions/changed-files@v41
26+
with:
27+
files: src/secureSignalEuid.ts
28+
29+
build:
30+
needs: [verify]
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
node-version: [20.x]
35+
target: [development, production]
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Use Node.js ${{ matrix.node-version }}
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
cache: 'npm'
44+
cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json
45+
- name: Install dependencies
46+
run: npm install
47+
- name: Build
48+
run: npm run build:esp -- --mode=${{ matrix.target }}
49+
50+
# Upload UID2 Secure Signals Files
51+
- name: Upload UID2 Secure Signals Files
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: ${{ matrix.target }}Uid2SecureSignalScript
55+
path: ./dist/uid2SecureSignal.js
56+
retention-days: 30
57+
58+
# Upload EUID Secure Signals Files
59+
- name: Upload EUID Secure Signals Files
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: ${{ matrix.target }}EuidSecureSignalScript
63+
path: ./dist/euidSecureSignal.js
64+
retention-days: 30
65+
66+
build-summary:
67+
needs: [build, verify]
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Build Summary
71+
run: |
72+
echo "## Secure Signal Build Complete! 🎉" >> $GITHUB_STEP_SUMMARY
73+
echo "" >> $GITHUB_STEP_SUMMARY
74+
echo "### Files Modified:" >> $GITHUB_STEP_SUMMARY
75+
echo "- UID2 Modified: ${{ needs.verify.outputs.uid2_modified }}" >> $GITHUB_STEP_SUMMARY
76+
echo "- EUID Modified: ${{ needs.verify.outputs.euid_modified }}" >> $GITHUB_STEP_SUMMARY
77+
echo "" >> $GITHUB_STEP_SUMMARY
78+
echo "### Artifacts Built:" >> $GITHUB_STEP_SUMMARY
79+
echo "- ✅ developmentUid2SecureSignalScript" >> $GITHUB_STEP_SUMMARY
80+
echo "- ✅ productionUid2SecureSignalScript" >> $GITHUB_STEP_SUMMARY
81+
echo "- ✅ developmentEuidSecureSignalScript" >> $GITHUB_STEP_SUMMARY
82+
echo "- ✅ productionEuidSecureSignalScript" >> $GITHUB_STEP_SUMMARY
83+
echo "" >> $GITHUB_STEP_SUMMARY
84+
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
85+
echo "Run the **Publish Secure Signal Package** workflow in the private repo to deploy these artifacts." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)