-
Notifications
You must be signed in to change notification settings - Fork 4
129 lines (119 loc) Β· 5.36 KB
/
Copy pathbuild-sdk-package.yml
File metadata and controls
129 lines (119 loc) Β· 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build SDK Package
run-name: ${{ inputs.release_type == 'Snapshot' && 'Build Pre-release' || format('Build {0}', inputs.release_type)}} SDK Package by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: The type of release
options:
- Major
- Minor
- Patch
- Snapshot
required: true
jobs:
incrementVersionNumber:
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v3
with:
release_type: ${{ inputs.release_type }}
merge_environment: ${{ github.ref_protected && 'ci-auto-merge' || '' }}
secrets: inherit
build:
runs-on: ubuntu-latest
needs: [incrementVersionNumber]
strategy:
matrix:
node-version: [20.x]
target: [development, production]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ needs.incrementVersionNumber.outputs.git_tag_or_hash }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Get Package Version
id: version
run: |
echo "package_version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
- name: Install dependencies
run: npm install
- name: Build SDK for CDN
run: npm run build -- --mode=${{ matrix.target }}
- name: Build NPM Package
if: matrix.target == 'production'
run: npm run build-package
# Upload SDK artifacts for CDN
- name: Upload UID2 SDK artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: uid2SDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }}
path: ./dist/uid2-sdk-${{ steps.version.outputs.package_version }}.js
retention-days: 30
- name: Upload EUID SDK artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: euidSDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }}
path: ./dist/euid-sdk-${{ steps.version.outputs.package_version }}.js
retention-days: 30
# Upload NPM package artifacts
- name: Upload UID2 NPM package
if: matrix.target == 'production'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: uid2-npm-package-${{ steps.version.outputs.package_version }}
path: ./dist/uid2-npm/
retention-days: 30
- name: Upload EUID NPM package
if: matrix.target == 'production'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: euid-npm-package-${{ steps.version.outputs.package_version }}
path: ./dist/euid-npm/
retention-days: 30
outputs:
sdkVersion: ${{ steps.version.outputs.package_version }}
git_tag: ${{ needs.incrementVersionNumber.outputs.git_tag_or_hash }}
new_version: ${{ needs.incrementVersionNumber.outputs.new_version }}
createNpmJsRelease:
needs: [incrementVersionNumber, build]
runs-on: ubuntu-latest
steps:
- name: Build Changelog
id: github_release_changelog
uses: mikepenz/release-changelog-builder-action@348e88fab4c37338b1e803ceb2d4a7a5db6c0833 # v6.2.2
with:
toTag: v${{ needs.incrementVersionNumber.outputs.new_version }}
configurationJson: |
{
"pr_template": " - #{{TITLE}} - ( PR: ##{{NUMBER}} )"
}
- name: Create Release Notes
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
name: v${{ needs.incrementVersionNumber.outputs.new_version }}
body: ${{ steps.github_release_changelog.outputs.changelog }}
draft: true
build-summary:
needs: [build, incrementVersionNumber]
runs-on: ubuntu-latest
steps:
- name: Build Summary
run: |
echo "## Build Complete! π" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "**Git Tag:** ${{ needs.build.outputs.git_tag }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts Built:" >> $GITHUB_STEP_SUMMARY
echo "- β
uid2SDK-development-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "- β
uid2SDK-production-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "- β
euidSDK-development-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "- β
euidSDK-production-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "- β
uid2-npm-package-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "- β
euid-npm-package-${{ needs.build.outputs.sdkVersion }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
echo "Run the **Publish SDK Package** workflow in the private repo to deploy these artifacts." >> $GITHUB_STEP_SUMMARY