Skip to content

Commit 78e9395

Browse files
npm registry
ISSUE: CLDSRVCLT-7
1 parent adc3ab3 commit 78e9395

File tree

2 files changed

+84
-42
lines changed

2 files changed

+84
-42
lines changed

.github/workflows/release.yml

Lines changed: 79 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,104 @@
11
---
2-
name: release
3-
run-name: release ${{ inputs.tag }}
2+
name: Release
3+
run-name: Release ${{ github.event.inputs.tag || '0.0.0-test' }}
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:
1111
inputs:
1212
tag:
1313
description: 'Tag to be released (e.g., 1.0.0)'
1414
required: true
1515

16+
17+
env:
18+
# Use input tag for workflow_dispatch, or test tag for push events
19+
RELEASE_TAG: ${{ github.event.inputs.tag || '0.0.0-test' }}
20+
1621
jobs:
17-
build-and-tag:
18-
name: Build and tag
22+
# check:
23+
# name: Preliminary checks
24+
# runs-on: ubuntu-latest
25+
# steps:
26+
# - name: Checkout code
27+
# uses: actions/checkout@v4
28+
29+
# - name: Ensure version matches tag
30+
# run: |
31+
# PACKAGE_VERSION=$(node -p "require('./package.json').version")
32+
# if [ "$PACKAGE_VERSION" != "${{ env.RELEASE_TAG }}" ]; then
33+
# echo "::error file=package.json::Version $PACKAGE_VERSION doesn't match tag ${{ env.RELEASE_TAG }}"
34+
# exit 1
35+
# fi
36+
37+
build:
38+
name: Build
1939
runs-on: ubuntu-latest
20-
permissions:
21-
contents: write
22-
2340
steps:
2441
- name: Checkout code
2542
uses: actions/checkout@v4
2643

2744
- name: Setup and Build
2845
uses: ./.github/actions/setup-and-build
2946

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"
47+
- name: Upload build artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: build-artifacts
51+
path: |
52+
dist/
53+
build/
3554
36-
# Force add the build folders (even if they are in .gitignore)
37-
git add -f dist build
55+
publish-npm:
56+
name: Publish to npm registry
57+
runs-on: ubuntu-latest
58+
needs: build
59+
permissions:
60+
contents: read
61+
id-token: write
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
3865

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

45-
# Commit the build artifacts
46-
git commit -m "Build artifacts for version $TAG_NAME"
71+
- name: Setup Node.js for npm registry
72+
uses: actions/setup-node@v4
73+
with:
74+
node-version: '24'
75+
registry-url: 'https://registry.npmjs.org'
4776

48-
# Create the tag
49-
git tag $TAG_NAME
77+
- name: Publish to npm with provenance
78+
run: npm publish --provenance --tag test
5079

51-
# Push the tag to the repository
52-
git push origin $TAG_NAME
80+
# create-release:
81+
# name: Create GitHub Release
82+
# runs-on: ubuntu-latest
83+
# needs: publish-npm
84+
# permissions:
85+
# contents: write
86+
# steps:
87+
# - name: Checkout code
88+
# uses: actions/checkout@v4
5389

54-
# Export tag name for next step
55-
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
56-
id: create_tag
90+
# - name: Create Git Tag
91+
# run: |
92+
# git config --global user.name "github-actions[bot]"
93+
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
94+
# git tag ${{ env.RELEASE_TAG }}
95+
# git push origin ${{ env.RELEASE_TAG }}
5796

58-
- name: Create GitHub Release
59-
uses: softprops/action-gh-release@v2
60-
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
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
# - name: Create GitHub Release
98+
# uses: softprops/action-gh-release@v2
99+
# with:
100+
# tag_name: ${{ env.RELEASE_TAG }}
101+
# name: Release ${{ env.RELEASE_TAG }}
102+
# generate_release_notes: true
103+
# env:
104+
# 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.0-test",
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)