|
| 1 | +name: Release on npm |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + paths: |
| 8 | + - packages/**/package.json |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: read |
| 13 | + id-token: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_and_publish: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Node |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version-file: ".nvmrc" |
| 26 | + registry-url: 'https://registry.npmjs.org' |
| 27 | + scope: '@makingchatbots' |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: npm install |
| 31 | + |
| 32 | + - name: Build |
| 33 | + run: | |
| 34 | + npm run clean |
| 35 | + npm run build |
| 36 | +
|
| 37 | + - id: publish_sdk |
| 38 | + name: Publish genesys-cloud-chatbot-tester |
| 39 | + uses: JS-DevTools/npm-publish@v3 |
| 40 | + with: |
| 41 | + package: packages/genesys-cloud-chatbot-tester |
| 42 | + token: ${{ secrets.NPM_TOKEN }} |
| 43 | + dry-run: false |
| 44 | + provenance: true |
| 45 | + access: public |
| 46 | + |
| 47 | + - id: publish_cli |
| 48 | + name: Publish genesys-cloud-chatbot-tester-cli |
| 49 | + uses: JS-DevTools/npm-publish@v3 |
| 50 | + with: |
| 51 | + package: packages/genesys-cloud-chatbot-tester-cli |
| 52 | + token: ${{ secrets.NPM_TOKEN }} |
| 53 | + dry-run: false |
| 54 | + provenance: true |
| 55 | + access: public |
| 56 | + |
| 57 | + - name: Post-publish genesys-cloud-chatbot-tester |
| 58 | + if: steps.publish_sdk.outputs.type != 'none' |
| 59 | + run: echo "Published genesys-cloud-chatbot-tester ${{ steps.publish_sdk.outputs.version }}" |
| 60 | + |
| 61 | + - name: Post-publish genesys-cloud-chatbot-tester-cli |
| 62 | + if: steps.publish_cli.outputs.type != 'none' |
| 63 | + run: echo "Published genesys-cloud-chatbot-tester-cli ${{ steps.publish_cli.outputs.version }}" |
| 64 | + |
| 65 | + - name: Configure changelog for genesys-cloud-chatbot-tester |
| 66 | + if: steps.publish_sdk.outputs.type != 'none' |
| 67 | + run: | |
| 68 | + cat <<'EOF' > changelog_config.json |
| 69 | + {"categories": [], "template": "## Commits:\n\n${{UNCATEGORIZED}}", "pr_template": "- ${{MERGE_SHA}} ${{TITLE}}"} |
| 70 | + EOF |
| 71 | + echo "last_tag=$(git describe --tags --match \"genesys-cloud-chatbot-tester-v*\" --abbrev=0 || echo)" >> $GITHUB_ENV |
| 72 | +
|
| 73 | + - name: Generate changelog for genesys-cloud-chatbot-tester |
| 74 | + if: steps.publish_sdk.outputs.type != 'none' |
| 75 | + id: changelog_tester |
| 76 | + |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + with: |
| 80 | + fromTag: "${{ env.last_tag }}" |
| 81 | + toTag: ${{ github.ref }} |
| 82 | + commitMode: true |
| 83 | + configuration: changelog_config.json |
| 84 | + |
| 85 | + - name: Create release for genesys-cloud-chatbot-tester |
| 86 | + if: steps.publish_sdk.outputs.type != 'none' |
| 87 | + uses: actions/create-release@v1 |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + with: |
| 91 | + tag_name: genesys-cloud-chatbot-tester-v${{ steps.publish_sdk.outputs.version }} |
| 92 | + release_name: genesys-cloud-chatbot-tester-v${{ steps.publish_sdk.outputs.version }} |
| 93 | + commitish: ${{ github.ref }} |
| 94 | + body: ${{ steps.changelog_tester.outputs.changelog }} |
| 95 | + draft: false |
| 96 | + prerelease: false |
| 97 | + |
| 98 | + - name: Configure changelog for genesys-cloud-chatbot-tester-cli |
| 99 | + if: steps.publish_cli.outputs.type != 'none' |
| 100 | + run: | |
| 101 | + cat <<'EOF' > changelog_config.json |
| 102 | + {"categories": [], "template": "## Commits:\n\n${{UNCATEGORIZED}}", "pr_template": "- ${{MERGE_SHA}} ${{TITLE}}"} |
| 103 | + EOF |
| 104 | + echo "last_tag=$(git describe --tags --match \"genesys-cloud-chatbot-tester-cli-v*\" --abbrev=0 || echo)" >> $GITHUB_ENV |
| 105 | +
|
| 106 | + - name: Generate changelog for genesys-cloud-chatbot-tester-cli |
| 107 | + if: steps.publish_cli.outputs.type != 'none' |
| 108 | + id: changelog_cli |
| 109 | + |
| 110 | + env: |
| 111 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + with: |
| 113 | + fromTag: "${{ env.last_tag }}" |
| 114 | + toTag: ${{ github.ref }} |
| 115 | + commitMode: true |
| 116 | + configuration: changelog_config.json |
| 117 | + |
| 118 | + - name: Create release for genesys-cloud-chatbot-tester-cli |
| 119 | + if: steps.publish_cli.outputs.type != 'none' |
| 120 | + uses: actions/create-release@v1 |
| 121 | + env: |
| 122 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 123 | + with: |
| 124 | + tag_name: genesys-cloud-chatbot-tester-cli-v${{ steps.publish_cli.outputs.version }} |
| 125 | + release_name: genesys-cloud-chatbot-tester-cli-v${{ steps.publish_cli.outputs.version }} |
| 126 | + commitish: ${{ github.ref }} |
| 127 | + body: ${{ steps.changelog_cli.outputs.changelog }} |
| 128 | + draft: false |
| 129 | + prerelease: false |
0 commit comments