Skip to content

Commit 95b045b

Browse files
npm registry
ISSUE: CLDSRVCLT-7
1 parent adc3ab3 commit 95b045b

File tree

2 files changed

+65
-41
lines changed

2 files changed

+65
-41
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,86 @@
11
---
2-
name: release
3-
run-name: release ${{ inputs.tag }}
2+
name: Release
3+
run-name: Release
44

55
on:
6-
# Uncomment to test your work as a release before it's merged
7-
# push:
8-
# branches:
9-
# - improvement/CLDSRVCLT-X
6+
# For testing - remove before merging
7+
push:
8+
branches:
9+
- improvement/CLDSRVCLT-7
1010
workflow_dispatch:
11-
inputs:
12-
tag:
13-
description: 'Tag to be released (e.g., 1.0.0)'
14-
required: true
1511

1612
jobs:
17-
build-and-tag:
18-
name: Build and tag
13+
build:
14+
name: Build
1915
runs-on: ubuntu-latest
20-
permissions:
21-
contents: write
22-
16+
outputs:
17+
version: ${{ steps.package-version.outputs.version }}
2318
steps:
2419
- name: Checkout code
2520
uses: actions/checkout@v4
2621

22+
- name: Get version from package.json
23+
id: package-version
24+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
25+
2726
- name: Setup and Build
2827
uses: ./.github/actions/setup-and-build
2928

30-
- name: Create Tag with Build Artifacts
31-
run: |
32-
# Configure git user to the GitHub Actions bot
33-
git config --global user.name "github-actions[bot]"
34-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
29+
- name: Upload build artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: build-artifacts
33+
path: |
34+
dist/
35+
build/
3536
36-
# Force add the build folders (even if they are in .gitignore)
37-
git add -f dist build
37+
publish-npm:
38+
name: Publish to npm registry
39+
runs-on: ubuntu-latest
40+
needs: build
41+
permissions:
42+
contents: read
43+
id-token: write
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
3847

39-
# Determine tag name
40-
TAG_NAME="${{ inputs.tag }}"
41-
if [ -z "$TAG_NAME" ]; then
42-
TAG_NAME="test-${{ github.sha }}"
43-
fi
48+
- name: Download build artifacts
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: build-artifacts
4452

45-
# Commit the build artifacts
46-
git commit -m "Build artifacts for version $TAG_NAME"
53+
- name: Setup Node.js for npm registry
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: '24'
57+
registry-url: 'https://registry.npmjs.org'
4758

48-
# Create the tag
49-
git tag $TAG_NAME
59+
- name: Publish to npm with provenance
60+
run: npm publish --provenance --tag latest
5061

51-
# Push the tag to the repository
52-
git push origin $TAG_NAME
62+
create-release:
63+
name: Create GitHub Release
64+
runs-on: ubuntu-latest
65+
needs: [build, publish-npm]
66+
permissions:
67+
contents: write
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
5371

54-
# Export tag name for next step
55-
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
56-
id: create_tag
72+
- name: Create Git Tag
73+
run: |
74+
git config --global user.name "github-actions[bot]"
75+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
76+
git tag ${{ needs.build.outputs.version }}
77+
git push origin ${{ needs.build.outputs.version }}
5778
5879
- name: Create GitHub Release
5980
uses: softprops/action-gh-release@v2
6081
with:
61-
tag_name: ${{ steps.create_tag.outputs.tag_name }}
62-
name: Release ${{ steps.create_tag.outputs.tag_name }}
63-
draft: false
64-
prerelease: false
82+
tag_name: ${{ needs.build.outputs.version }}
83+
name: Release ${{ needs.build.outputs.version }}
84+
generate_release_notes: true
6585
env:
6686
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@scality/cloudserverclient",
3-
"version": "1.0.0",
3+
"version": "0.0.2",
44
"engines": {
55
"node": ">=20"
66
},
@@ -11,6 +11,10 @@
1111
"dist",
1212
"build/smithy/source/typescript-codegen"
1313
],
14+
"publishConfig": {
15+
"access": "public",
16+
"registry": "https://registry.npmjs.org"
17+
},
1418
"scripts": {
1519
"clean:build": "rm -rf build dist",
1620
"build:smithy": "smithy build",

0 commit comments

Comments
 (0)