Skip to content

Commit ce70df1

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

File tree

2 files changed

+83
-42
lines changed

2 files changed

+83
-42
lines changed

.github/workflows/release.yml

Lines changed: 78 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,103 @@
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+
env:
17+
# Use input tag for workflow_dispatch, or test tag for push events
18+
RELEASE_TAG: ${{ github.event.inputs.tag || '0.0.0-test' }}
19+
1620
jobs:
17-
build-and-tag:
18-
name: Build and tag
21+
# check:
22+
# name: Preliminary checks
23+
# runs-on: ubuntu-latest
24+
# steps:
25+
# - name: Checkout code
26+
# uses: actions/checkout@v4
27+
28+
# - name: Ensure version matches tag
29+
# run: |
30+
# PACKAGE_VERSION=$(node -p "require('./package.json').version")
31+
# if [ "$PACKAGE_VERSION" != "${{ env.RELEASE_TAG }}" ]; then
32+
# echo "::error file=package.json::Version $PACKAGE_VERSION doesn't match tag ${{ env.RELEASE_TAG }}"
33+
# exit 1
34+
# fi
35+
36+
build:
37+
name: Build
1938
runs-on: ubuntu-latest
20-
permissions:
21-
contents: write
22-
2339
steps:
2440
- name: Checkout code
2541
uses: actions/checkout@v4
2642

2743
- name: Setup and Build
2844
uses: ./.github/actions/setup-and-build
2945

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

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

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

48-
# Create the tag
49-
git tag $TAG_NAME
76+
- name: Publish to npm with provenance
77+
run: npm publish --provenance --access public
5078

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

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

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 }}
96+
# - name: Create GitHub Release
97+
# uses: softprops/action-gh-release@v2
98+
# with:
99+
# tag_name: ${{ env.RELEASE_TAG }}
100+
# name: Release ${{ env.RELEASE_TAG }}
101+
# generate_release_notes: true
102+
# env:
103+
# 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)