Skip to content

Commit 600ab90

Browse files
npm registry
ISSUE: CLDSRVCLT-7
1 parent 91ed87b commit 600ab90

File tree

2 files changed

+60
-40
lines changed

2 files changed

+60
-40
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,82 @@
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
106
workflow_dispatch:
11-
inputs:
12-
tag:
13-
description: 'Tag to be released (e.g., 1.0.0)'
14-
required: true
157

168
jobs:
17-
build-and-tag:
18-
name: Build and tag
9+
build:
10+
name: Build
1911
runs-on: ubuntu-latest
20-
permissions:
21-
contents: write
22-
12+
outputs:
13+
version: ${{ steps.package-version.outputs.version }}
2314
steps:
2415
- name: Checkout code
2516
uses: actions/checkout@v4
2617

18+
- name: Get version from package.json
19+
id: package-version
20+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
21+
2722
- name: Setup and Build
2823
uses: ./.github/actions/setup-and-build
2924

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"
25+
- name: Upload build artifacts
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: build-artifacts
29+
path: |
30+
dist/
31+
build/
3532
36-
# Force add the build folders (even if they are in .gitignore)
37-
git add -f dist build
33+
publish-npm:
34+
name: Publish to npm registry
35+
runs-on: ubuntu-latest
36+
needs: build
37+
permissions:
38+
contents: read
39+
id-token: write
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
3843

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

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

48-
# Create the tag
49-
git tag $TAG_NAME
55+
- name: Publish to npm with provenance
56+
run: npm publish --provenance --tag latest
5057

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

54-
# Export tag name for next step
55-
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
56-
id: create_tag
68+
- name: Create Git Tag
69+
run: |
70+
git config --global user.name "github-actions[bot]"
71+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
72+
git tag ${{ needs.build.outputs.version }}
73+
git push origin ${{ needs.build.outputs.version }}
5774
5875
- name: Create GitHub Release
5976
uses: softprops/action-gh-release@v2
6077
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
78+
tag_name: ${{ needs.build.outputs.version }}
79+
name: Release ${{ needs.build.outputs.version }}
80+
generate_release_notes: true
6581
env:
6682
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)