Skip to content

Commit c81d5a6

Browse files
alexslavrCopilotCopilot
authored
Setup trusted publishing for npm packages, restructure workflows (#720)
Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent bc162d6 commit c81d5a6

2 files changed

Lines changed: 103 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109

110110
- if: ${{ env.RELEASE_KEY_SECRET != '' }}
111111
run: |
112-
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
112+
wget https://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
113113
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
114114
curl -L -o /opt/secure-file.zip https://github.com/appveyor/secure-file/releases/download/1.0.1/secure-file.zip
115115
unzip /opt/secure-file.zip -d /opt/secure-file

.github/workflows/publish.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry-run:
7+
description: 'Dry run (skip actual publishing)'
8+
type: boolean
9+
default: false
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
NPM_CONFIG_AUDIT: "false"
16+
NPM_CONFIG_FUND: "false"
17+
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
18+
NUGET_XMLDOC_MODE: "skip"
19+
20+
jobs:
21+
22+
pack:
23+
runs-on: ubuntu-24.04
24+
25+
env:
26+
RELEASE_KEY_SECRET: ${{ secrets.RELEASE_KEY_SECRET }}
27+
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
28+
29+
steps:
30+
- uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-quality: ga
33+
dotnet-version: |
34+
3.1
35+
8.0
36+
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: '24'
40+
41+
- uses: actions/checkout@v4
42+
43+
- name: Decrypt signing key
44+
if: ${{ env.RELEASE_KEY_SECRET != '' }}
45+
run: |
46+
wget https://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
47+
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
48+
curl -L -o /opt/secure-file.zip https://github.com/appveyor/secure-file/releases/download/1.0.1/secure-file.zip
49+
unzip /opt/secure-file.zip -d /opt/secure-file
50+
dotnet /opt/secure-file/secure-file.dll -decrypt net/DevExtreme.AspNet.Data/release.snk.enc -secret ${{ env.RELEASE_KEY_SECRET }}
51+
52+
- name: Build no-jquery package
53+
run: node build/make-nojquery
54+
55+
- name: Set package versions
56+
run: node build/replace-meta "${{ github.run_number }}" "${{ github.ref }}" "${{ github.repository }}"
57+
58+
- name: Pack npm packages
59+
run: |
60+
npm pack
61+
npm pack ./js-nojquery
62+
63+
- name: Pack NuGet package
64+
if: ${{ env.RELEASE_KEY_SECRET != '' }}
65+
run: dotnet pack net/DevExtreme.AspNet.Data --configuration=Release --include-symbols
66+
67+
- name: Upload NuGet packages as artifacts
68+
if: ${{ env.RELEASE_KEY_SECRET != '' }}
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: nuget-packages
72+
path: net/DevExtreme.AspNet.Data/bin/Release/*.nupkg
73+
74+
- name: Upload npm packages as artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: npm-packages
78+
path: devextreme-aspnet-data-*.tgz
79+
80+
publish:
81+
runs-on: ubuntu-latest
82+
needs: pack
83+
if: startsWith(github.ref, 'refs/tags/')
84+
environment: npmjs
85+
permissions:
86+
contents: read
87+
id-token: write
88+
89+
steps:
90+
- uses: actions/setup-node@v4
91+
with:
92+
node-version: '24'
93+
registry-url: 'https://registry.npmjs.org'
94+
95+
- uses: actions/download-artifact@v4
96+
with:
97+
name: npm-packages
98+
99+
- name: Publish to npmjs
100+
run: |
101+
npm publish devextreme-aspnet-data-nojquery-*.tgz --provenance --access public ${{ inputs['dry-run'] && '--dry-run' || '' }}
102+
npm publish devextreme-aspnet-data-[0-9]*.tgz --provenance --access public ${{ inputs['dry-run'] && '--dry-run' || '' }}

0 commit comments

Comments
 (0)