|
| 1 | +name: Publish to npm |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [feature/test-release] |
| 7 | + |
| 8 | +permissions: |
| 9 | + id-token: write # Required for OIDC authentication with npm |
| 10 | + contents: write # Required to push version commits |
| 11 | + |
| 12 | +jobs: |
| 13 | + publish: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + |
| 20 | + - name: Setup Node.js |
| 21 | + uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: '24.x' |
| 24 | + registry-url: 'https://registry.npmjs.org' |
| 25 | + scope: '@aws-toolkits' |
| 26 | + |
| 27 | + - name: Debug info and skip validation for testing |
| 28 | + run: | |
| 29 | + VERSION=$(cat version) |
| 30 | + echo "Current version: $VERSION" |
| 31 | + echo "Git log authors (last 5 commits):" |
| 32 | + git log --pretty=format:"%an - %s" -5 |
| 33 | + echo "" |
| 34 | + echo "Skipping validation check for manual testing" |
| 35 | + echo "SHOULD_RELEASE=true (forced for testing)" |
| 36 | +
|
| 37 | + - name: Increment version and commit |
| 38 | + run: | |
| 39 | + git config --global user.name "aws-toolkit-automation" |
| 40 | + git config --global user.email "<>" |
| 41 | + |
| 42 | + echo "Before version increment:" |
| 43 | + cat version |
| 44 | + |
| 45 | + # increase the version |
| 46 | + cat version | (IFS="." ; read a b c && echo $a.$b.$((c + 1)) > version) |
| 47 | + VERSION=$(cat version) |
| 48 | + echo "After version increment: $VERSION" |
| 49 | + |
| 50 | + git add version |
| 51 | + git commit -m "Release version $VERSION" |
| 52 | + echo "Pushing to feature/test-release branch" |
| 53 | + git push origin feature/test-release |
| 54 | +
|
| 55 | + - name: Build npm package |
| 56 | + run: | |
| 57 | + VERSION=$(cat version) |
| 58 | + echo "Building package with version: $VERSION" |
| 59 | + cd telemetry/vscode |
| 60 | + echo "Installing dependencies..." |
| 61 | + npm ci |
| 62 | + echo "Setting npm package version..." |
| 63 | + npm version "$VERSION" |
| 64 | + echo "Creating package..." |
| 65 | + npm pack |
| 66 | + echo "Package files created:" |
| 67 | + ls -la *.tgz |
| 68 | +
|
| 69 | + - name: Publish to npm |
| 70 | + run: | |
| 71 | + cd telemetry/vscode |
| 72 | + echo "Publishing package to npm..." |
| 73 | + npm publish $(ls -1 *.tgz) --access public |
| 74 | + echo "Package published successfully!" |
0 commit comments