1- name : Publish packages
1+ name : Publish npm package
22
33on :
4- workflow_dispatch :
54 push :
65 branches : [main]
76
87permissions :
98 id-token : write # Required for OIDC authentication with npm
10- contents : write # Required to push version commits
119
1210jobs :
13- publish :
11+ publish-npm :
12+ # Only run if the commit is from aws-toolkit-automation (version increment)
13+ if : github.event.head_commit.author.name == 'aws-toolkit-automation'
1414 runs-on : ubuntu-latest
1515 steps :
1616 - uses : actions/checkout@v4
17- with :
18- token : ${{ secrets.GITHUB_TOKEN }}
1917
2018 - name : Setup Node.js
2119 uses : actions/setup-node@v4
@@ -24,71 +22,12 @@ jobs:
2422 registry-url : ' https://registry.npmjs.org'
2523 scope : ' @aws-toolkits'
2624
27- - name : Validate release commits
28- run : |
29- VERSION=$(cat version)
30- echo "validating for package version: $VERSION"
31-
32- # Now we check if there are any "interesting" commits to create a release version. These are any
33- # commits that are neither 1. from dependabot or 2. a release commit.
34- AUTHOR_DEPENDABOT="dependabot[bot]"
35- AUTHOR_AUTOMATION="aws-toolkit-automation"
36-
37- SHOULD_RELEASE=false
38- for author in $(git log --pretty=%an)
39- do
40- if [ "$author" = $AUTHOR_DEPENDABOT ]; then
41- # Ignore dependabot commits, keep searching.
42- continue
43- elif [ "$author" != $AUTHOR_AUTOMATION ]; then
44- # Found a commit to release since last release.
45- SHOULD_RELEASE=true
46- echo "found at least one commit to release, author: $author"
47- fi
48-
49- # If the commit wasn't from dependabot, then we have enough information.
50- break
51- done
52-
53- if [ $SHOULD_RELEASE != true ]; then
54- echo "no commits detected that are not from '$AUTHOR_DEPENDABOT' or '$AUTHOR_AUTOMATION'. skipping release."
55- exit 1
56- fi
57-
58- - name : Increment version and commit
59- run : |
60- git config --global user.name "aws-toolkit-automation"
61- git config --global user.email "<>"
62-
63- # increase the version
64- cat version | (IFS="." ; read a b c && echo $a.$b.$((c + 1)) > version)
65- VERSION=$(cat version)
66- echo "version is now: $VERSION"
67-
68- git add version
69- git commit -m "Release version $VERSION"
70- git push origin main
71-
72- - name : Build npm package
25+ - name : Build and publish npm package
7326 run : |
7427 VERSION=$(cat version)
28+ echo "Publishing npm package version: $VERSION"
7529 cd telemetry/vscode
7630 npm ci
7731 npm version "$VERSION"
7832 npm pack
79-
80- - name : Publish to npm
81- run : |
82- cd telemetry/vscode
8333 npm publish $(ls -1 *.tgz) --access public
84-
85- - name : Configure AWS credentials
86- uses : aws-actions/configure-aws-credentials@v4
87- with :
88- role-to-assume : arn:aws:iam::305657142372:role/GitHubActionsCodePipelineRole
89- role-session-name : github-actions-codepipeline
90- aws-region : us-west-2
91-
92- - name : Trigger CodePipeline for Maven/NuGet
93- run : |
94- aws codepipeline start-pipeline-execution --name PackagePipeline
0 commit comments