7
7
8
8
env :
9
9
FORCE_COLOR : " 1"
10
+ # NPM_REGISTRY: jfrog.ledgerlabs.net/artifactory/api/npm/ldk-npm-prod-public
11
+ NPM_REGISTRY : jfrog.ledgerlabs.net/artifactory/api/npm/ldk-npm-sandbox-green
10
12
11
13
permissions :
12
14
id-token : write
13
15
contents : write
14
16
pull-requests : write
17
+ # Need to attest artifacts
18
+ attestations : write
15
19
16
20
jobs :
17
21
publish :
@@ -20,59 +24,75 @@ jobs:
20
24
steps :
21
25
- uses : actions/checkout@v4
22
26
23
- - uses : ./.github/actions/setup-toolchain-composite
27
+ # - uses: ./.github/actions/setup-toolchain-composite
24
28
25
- - name : install dependencies
26
- run : pnpm install
29
+ # - name: install dependencies
30
+ # run: pnpm install
27
31
28
- - name : build libraries
29
- run : pnpm build
32
+ # - name: build libraries
33
+ # run: pnpm build
30
34
31
35
- name : Login to internal JFrog registry
32
36
id : jfrog-login
33
37
uses : LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1
34
38
35
39
- name : Setup npm config for JFrog
36
40
env :
37
- # NPM_REGISTRY: jfrog.ledgerlabs.net/artifactory/api/npm/ldk-npm-prod-public
38
- NPM_REGISTRY : jfrog.ledgerlabs.net/artifactory/api/npm/ldk-npm-sandbox-green
39
41
NPM_REGISTRY_TOKEN : ${{ steps.jfrog-login.outputs.oidc-token }}
40
42
run : |
41
43
cat << EOF | tee .npmrc
42
44
registry=https://${NPM_REGISTRY}/
43
45
//${NPM_REGISTRY}/:_authToken=${NPM_REGISTRY_TOKEN}
44
46
EOF
45
47
46
- - name : Publish
47
- id : changesets
48
- uses : changesets/action@v1
49
- # to remove
50
- with :
51
- publish : pnpm release
52
- # to remove
53
- branch : feat/no-issue-jfrog-attest-sign-package
54
- env :
55
- GITHUB_TOKEN : ${{ secrets.CI_BOT_TOKEN }}
48
+ # - name: Publish
49
+ # id: changesets
50
+ # uses: changesecahts/action@v1
51
+ # with:
52
+ # publish: pnpm release
53
+ # # to remove
54
+ # title: "⚙️ (release) [NO-ISSUE]: Version packages"
55
+ # commit: "⚙️ (release): Version packages"
56
+ # branch: feat/no-issue-jfrog-attest-sign-package
57
+ # createGithubReleases: false
58
+ # env:
59
+ # GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
56
60
57
61
- name : Download published packages to attest and sign
58
62
# if: steps.changesets.outputs.published == 'true'
63
+ env :
64
+ PUBLISHED_PACKAGE_JSON : published-packages.json
59
65
run : |
60
- # Extract package name
61
- PACKAGE_NAME=${{ steps.changesets.outputs.publishedPackages }}
62
-
63
- echo $PACKAGE_NAME
66
+ # Extract packages name
67
+ # output will be in the form of: [{"name":"@ledgerhq/package-name","version":"X.X.X"}]
68
+ cat << EOF | tee $PUBLISHED_PACKAGE_JSON
69
+ [{"name":"@ledgerhq/device-sdk-ts","version":"0.4.0"}]
70
+ EOF
64
71
65
- mkdir dist
72
+ # Create dist directory
73
+ mkdir -p dist
66
74
67
- # - name: Attest tarball
68
- # if: steps.changesets.outputs.published == 'true'
69
- # uses: LedgerHQ/actions-security/actions/attest@actions/attest-1
70
- # with:
71
- # subject-path: ./dist
72
- # push-to-registry: true
75
+ # Loop over package names and download the tarball into dist directory
76
+ for row in $(cat $PUBLISHED_PACKAGE_JSON | jq -r '.[] | @text'); do
77
+ PACKAGE_NAME=$(echo $row| jq -r '.name')
78
+ PACKAGE_VERSION=$(echo $row | jq -r '.version')
79
+ PACKAGE_NAME_BASENAME=$(basename ${PACKAGE_NAME})
73
80
74
- # - name: Sign tarball
75
- # if: steps.changesets.outputs.published == 'true'
76
- # uses: LedgerHQ/actions-security/actions/sign-blob@actions/sign-blob-1
77
- # with:
78
- # path: ./dist
81
+ echo -e "\033[0;32mDownload artifact from\033[0m https://${NPM_REGISTRY}/${PACKAGE_NAME}/-/${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz"
82
+ curl -H "Authorization: Bearer ${{ steps.jfrog-login.outputs.oidc-token }}" \
83
+ -o dist/${PACKAGE_NAME_BASENAME}-${PACKAGE_VERSION}.tgz \
84
+ https://${NPM_REGISTRY}/${PACKAGE_NAME}/-/${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz
85
+ done
86
+
87
+ - name : Attest tarball
88
+ # if: steps.changesets.outputs.published == 'true'
89
+ uses : actions/attest-build-provenance@v1
90
+ with :
91
+ subject-path : ./dist
92
+
93
+ # The action currently doesn't support pushing the blob to the registry
94
+ - name : Sign tarball
95
+ # if: steps.changesets.outputs.published == 'true'
96
+ uses : LedgerHQ/actions-security/actions/sign-blob@actions/sign-blob-1
97
+ with :
98
+ path : ./dist
0 commit comments