Skip to content

Commit f242c2d

Browse files
authored
ci: add npm-publish workflow (#320)
*Issue #, if available:* *Description of changes:* adding npm-publish Github Actions Workflow that I tested in #319. Since the other branch is publishing an empty package, it's difficult to directly merge from that branch. I've strictly copied over the required workflow files. Prior to publishing our packages to npm we still need to change the versions to 1.0.0. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 0df43d6 commit f242c2d

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
for package_dir in packages/*; do
4+
if [ -d "$package_dir" ] && [[ "$package_dir" == "packages/aws-durable-execution-sdk-js-testing" || "$package_dir" == "packages/aws-durable-execution-sdk-js" || "$package_dir" == "packages/aws-durable-execution-sdk-js-eslint-plugin" ]]; then
5+
echo "$package_dir";
6+
cd "$package_dir";
7+
echo "Publishing package in $package_dir";
8+
npm publish --access public;
9+
cd ../..;
10+
fi
11+
done

.github/workflows/npm-publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: npm publish
5+
permissions:
6+
contents: read
7+
on:
8+
release:
9+
types: [published]
10+
jobs:
11+
npm-publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 22
18+
registry-url: https://registry.npmjs.org/
19+
- run: npm ci
20+
- run: npm run build
21+
- run: npm run test
22+
- name: Make script executable
23+
run: chmod +x ./.github/workflows/iterate-publish-npm.sh
24+
- name: iterate and publish
25+
run: ./.github/workflows/iterate-publish-npm.sh
26+
shell: bash
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)