|
| 1 | +name: Build and release ACS Chat Adapter (Preview) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - feat-acs-chat-adapter |
| 7 | + |
| 8 | +env: |
| 9 | + RELEASE_NAME: feat-acs-chat-adapter |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checking out for ${{ github.ref }} |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - run: npx version-from-git --no-git-tag-version |
| 20 | + |
| 21 | + - run: npm ci --no-production |
| 22 | + |
| 23 | + - name: Propagate versions |
| 24 | + run: node_modules/.bin/lerna version --exact --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version` |
| 25 | + |
| 26 | + - run: npm run bootstrap |
| 27 | + - run: npm run build -- --ignore=acs-app |
| 28 | + env: |
| 29 | + NODE_ENV: production |
| 30 | + |
| 31 | + - run: mkdir -p artifacts/tarballs/ |
| 32 | + |
| 33 | + - name: Pack all packages |
| 34 | + run: | |
| 35 | + for PACKAGE_NAME in "acs-chat-adapter" "api" "bundle" "component" "core" |
| 36 | + do |
| 37 | + cd packages/$PACKAGE_NAME |
| 38 | + npm pack . |
| 39 | + cp *.tgz ../../artifacts/tarballs/ |
| 40 | + cd ../../ |
| 41 | + done |
| 42 | +
|
| 43 | + - name: Upload all packages |
| 44 | + uses: actions/upload-artifact@v2 |
| 45 | + with: |
| 46 | + name: packages |
| 47 | + path: artifacts/tarballs/ |
| 48 | + |
| 49 | + deploy: |
| 50 | + needs: build |
| 51 | + runs-on: ubuntu-latest |
| 52 | + |
| 53 | + steps: |
| 54 | + - id: compute_hash |
| 55 | + name: Compute build metadata |
| 56 | + run: | |
| 57 | + echo "::set-output name=git_short_sha::`echo ${{ github.sha }} | cut -c 1-7`" |
| 58 | + echo "::set-output name=package_version::`tar -xOzf botframework-webchat-chat-adapter-acs-*.tgz package/package.json | jq -r '.version'`" |
| 59 | + echo "::set-output name=release_date::`date \"+%Y-%m-%d %R:%S\"`" |
| 60 | +
|
| 61 | + - name: Display build metadata |
| 62 | + run: | |
| 63 | + echo git_short_sha=${{ steps.compute_hash.outputs.git_short_sha }} |
| 64 | + echo package_version=${{ steps.compute_hash.outputs.package_version }} |
| 65 | + echo release_date=${{ steps.compute_hash.outputs.release_date }} |
| 66 | +
|
| 67 | + - uses: actions/download-artifact@v2 |
| 68 | + with: |
| 69 | + name: packages |
| 70 | + |
| 71 | + - name: Delete existing release |
| 72 | + # When this workflow is run in its first time, or 2+ are running side-by-side, the release may not exists. It is okay to ignore 404s. |
| 73 | + continue-on-error: true |
| 74 | + env: |
| 75 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + run: gh release delete $RELEASE_NAME --repo ${{ github.repository }} --yes |
| 77 | + |
| 78 | + - name: Create release |
| 79 | + id: create_release |
| 80 | + uses: actions/create-release@v1 |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + with: |
| 84 | + tag_name: $RELEASE_NAME |
| 85 | + release_name: Continuous integration (${{ github.ref }}) |
| 86 | + body: | |
| 87 | + This release will be updated on every push. **Please do not use this build in production environment.** |
| 88 | +
|
| 89 | + | Build time | Run ID | Source version | Git ref | Package version | |
| 90 | + | - | - | - | - | - | |
| 91 | + | ${{ steps.compute_hash.outputs.release_date }}Z | [`${{ github.run_id }}`](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | [`${{ steps.compute_hash.outputs.git_short_sha }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | `${{ github.ref }}` | `${{ steps.compute_hash.outputs.package_version }}` | |
| 92 | + draft: false |
| 93 | + prerelease: true |
| 94 | + |
| 95 | + - name: Upload assets |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + run: gh release upload $RELEASE_NAME *.tgz --repo ${{ github.repository }} |
| 99 | + |
| 100 | + # release: |
| 101 | + # needs: build |
| 102 | + # runs-on: ubuntu-latest |
| 103 | + |
| 104 | + # steps: |
| 105 | + # - uses: actions/download-artifact@v2 |
| 106 | + # with: |
| 107 | + # name: bundles |
| 108 | + |
| 109 | + # - uses: actions/download-artifact@v2 |
| 110 | + # with: |
| 111 | + # name: tarballs |
| 112 | + |
| 113 | + # - id: compute_hash |
| 114 | + # name: Compute build metadata |
| 115 | + # run: | |
| 116 | + # echo "::set-output name=git_short_sha::`echo ${{ github.sha }} | cut -c 1-7`" |
| 117 | + # echo "::set-output name=package_version::`tar -xOzf botframework-webchat-4*.tgz package/package.json | jq -r '.version'`" |
| 118 | + # echo "::set-output name=release_date::`date \"+%Y-%m-%d %R:%S\"`" |
| 119 | + # echo "::set-output name=release_tag_name::daily" |
| 120 | + # echo "::set-output name=sha384_es5::`cat webchat-es5.js | openssl dgst -sha384 -binary | openssl base64 -A`" |
| 121 | + # echo "::set-output name=sha384_full::`cat webchat.js | openssl dgst -sha384 -binary | openssl base64 -A`" |
| 122 | + # echo "::set-output name=sha384_minimal::`cat webchat-minimal.js | openssl dgst -sha384 -binary | openssl base64 -A`" |
| 123 | + |
| 124 | + # - name: Display build metadata |
| 125 | + # run: | |
| 126 | + # echo git_short_sha=${{ steps.compute_hash.outputs.git_short_sha }} |
| 127 | + # echo package_version=${{ steps.compute_hash.outputs.package_version }} |
| 128 | + # echo release_date=${{ steps.compute_hash.outputs.release_date }} |
| 129 | + # echo release_tag_name=${{ steps.compute_hash.outputs.release_tag_name }} |
| 130 | + # echo sha384_es5=${{ steps.compute_hash.outputs.sha384_es5 }} |
| 131 | + # echo sha384_full=${{ steps.compute_hash.outputs.sha384_full }} |
| 132 | + # echo sha384_minimal=${{ steps.compute_hash.outputs.sha384_minimal }} |
| 133 | + |
| 134 | + # - name: Delete existing release |
| 135 | + # # When this workflow is run in its first time, or 2+ are running side-by-side, the release may not exists. It is okay to ignore 404s. |
| 136 | + # continue-on-error: true |
| 137 | + # env: |
| 138 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + # run: gh release delete ${{ steps.compute_hash.outputs.release_tag_name }} --repo ${{ github.repository }} --yes |
| 140 | + |
| 141 | + # - name: Create release |
| 142 | + # id: create_release |
| 143 | + # uses: actions/create-release@v1 |
| 144 | + # env: |
| 145 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 146 | + # with: |
| 147 | + # tag_name: ${{ steps.compute_hash.outputs.release_tag_name }} |
| 148 | + # release_name: Daily (${{ github.ref }}) |
| 149 | + # body: | |
| 150 | + # This release will be updated daily. **Please do not use this build in production environment.** |
| 151 | + |
| 152 | + # | Build time | Run ID | Source version | Git ref | Package version | |
| 153 | + # | - | - | - | - | - | |
| 154 | + # | ${{ steps.compute_hash.outputs.release_date }}Z | [`${{ github.run_id }}`](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | [`${{ steps.compute_hash.outputs.git_short_sha }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | `${{ github.ref }}` | `${{ steps.compute_hash.outputs.package_version }}` | |
| 155 | + |
| 156 | + # ```html |
| 157 | + # <script |
| 158 | + # crossorigin="anonymous" |
| 159 | + # integrity="sha384-${{ steps.compute_hash.outputs.sha384_full }}" |
| 160 | + # src="https://github.com/microsoft/BotFramework-WebChat/releases/download/${{ steps.compute_hash.outputs.release_tag_name }}/webchat.js" |
| 161 | + # ></script> |
| 162 | + |
| 163 | + # <script |
| 164 | + # crossorigin="anonymous" |
| 165 | + # integrity="sha384-${{ steps.compute_hash.outputs.sha384_es5 }}" |
| 166 | + # src="https://github.com/microsoft/BotFramework-WebChat/releases/download/${{ steps.compute_hash.outputs.release_tag_name }}/webchat-es5.js" |
| 167 | + # ></script> |
| 168 | + |
| 169 | + # <script |
| 170 | + # crossorigin="anonymous" |
| 171 | + # integrity="sha384-${{ steps.compute_hash.outputs.sha384_minimal }}" |
| 172 | + # src="https://github.com/microsoft/BotFramework-WebChat/releases/download/${{ steps.compute_hash.outputs.release_tag_name }}/webchat-minimal.js" |
| 173 | + # ></script> |
| 174 | + # ``` |
| 175 | + |
| 176 | + # > Note: the SHA384 hash may change daily. |
| 177 | + # draft: false |
| 178 | + # prerelease: true |
| 179 | + |
| 180 | + # - name: Upload assets |
| 181 | + # env: |
| 182 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 183 | + # run: gh release upload ${{ steps.compute_hash.outputs.release_tag_name }} *.js *.json *.tgz --repo ${{ github.repository }} |
0 commit comments