Skip to content

Commit ed3caa7

Browse files
jkowalleckrelease bot
andauthored
chore: publish package to GithubPackages (#1078)
fixes #1026 --------- Signed-off-by: Jan Kowalleck <[email protected]> Signed-off-by: release bot <[email protected]> Signed-off-by: jkowalleck <[email protected]> Co-authored-by: jkowalleck <[email protected]> Co-authored-by: release bot <[email protected]>
1 parent ddb4753 commit ed3caa7

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: Configure Git
5353
# needed for push back of changes
5454
run: |
55-
set -ex
55+
set -eux
5656
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
5757
git config --local user.name "${GITHUB_ACTOR}"
5858
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
@@ -64,8 +64,9 @@ jobs:
6464
- name: bump VERSION
6565
id: bump
6666
run: |
67-
set -ex
68-
VERSION="$(npm version "$NPMV_NEWVERSION" --message "$NPMV_MESSAGE" --preid "$NPMV_PREID")"
67+
set -eux
68+
COMMIT_SIG="Signed-off-by: $(git config user.name) <$(git config user.email)>"
69+
VERSION="$( npm version "$NPMV_NEWVERSION" --message "$NPMV_MESSAGE"$'\n\n'"$COMMIT_SIG" --preid "$NPMV_PREID" )"
6970
echo "::debug::new version = $VERSION"
7071
VERSION_PLAIN="${VERSION:1}" # remove 'v' prefix
7172
echo "::debug::plain version = $VERSION_PLAIN"
@@ -78,14 +79,14 @@ jobs:
7879
- name: git push back
7980
run: git push --follow-tags
8081

81-
publish-NPMJS:
82+
publish-package:
8283
needs:
8384
- "bump"
84-
name: publish NPMJS
85+
name: publish package
8586
runs-on: ubuntu-latest
8687
timeout-minutes: 30
8788
env:
88-
NPMJS_RELEASE_TAG: ${{ github.event.inputs.prerelease == 'true' && 'unstable-prerelease' || 'latest' }}
89+
PACKAGE_RELEASE_TAG: ${{ github.event.inputs.prerelease == 'true' && 'unstable-prerelease' || 'latest' }}
8990
steps:
9091
- name: Checkout code
9192
# see https://github.com/actions/checkout
@@ -100,16 +101,27 @@ jobs:
100101
- name: install build tools
101102
run: npm i --ignore-scripts --include=optional --loglevel=silly
102103
# no explicit npm build. if a build is required, it should be configured as prepublish/prepublishOnly script of npm.
103-
- name: login to NPMJS
104-
run: npm config set "//registry.npmjs.org/:_authToken=$NPMJS_AUTH_TOKEN"
104+
- name: login to registries
105+
run: |
106+
npm config set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
107+
npm config set "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN"
105108
env:
106-
NPMJS_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
107-
- name: publish to NPMJS as "${{ env.NPMJS_RELEASE_TAG }}"
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
111+
- name: publish to NPMJS as "${{ env.PACKAGE_RELEASE_TAG }}"
112+
run: >
113+
npm publish
114+
--@cyclonedx:registry='https://registry.npmjs.org'
115+
--provenance
116+
--access public
117+
--tag "$PACKAGE_RELEASE_TAG"
118+
- name: publish to GitHub as "${{ env.PACKAGE_RELEASE_TAG }}"
108119
run: >
109-
npm publish
120+
npm publish
121+
--@cyclonedx:registry='https://npm.pkg.github.com'
110122
--provenance
111123
--access public
112-
--tag "$NPMJS_RELEASE_TAG"
124+
--tag "$PACKAGE_RELEASE_TAG"
113125
- name: pack release result
114126
run: |
115127
mkdir -p "$PACKED_DIR"
@@ -125,7 +137,7 @@ jobs:
125137
release-GH:
126138
needs:
127139
- "bump"
128-
- "publish-NPMJS"
140+
- "publish-package"
129141
name: publish GitHub
130142
runs-on: ubuntu-latest
131143
timeout-minutes: 30

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
66

77
<!-- add unreleased items here -->
88

9+
* Chore
10+
* The package will be published to GitHub package registry, too. ([#1026] via [#1078])
11+
12+
[#1026]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1026
13+
[#1078]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1078
14+
915
## 6.9.0 -- 2024-05-23
1016

1117
* Changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cyclonedx/cyclonedx-library",
3-
"version": "6.9.0",
3+
"version": "6.9.4",
44
"description": "Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).",
55
"license": "Apache-2.0",
66
"keywords": [

0 commit comments

Comments
 (0)