Skip to content

Commit 8f2b9c8

Browse files
authored
Add GitHub workflow and bump deps (#390)
* Add GitHub workflow * Add workflows * Prefix "do-not-use" * Only on specific branch * Add --access public to npm publish * 0.0.1-0 * Add job summary * Flush job output * Flush job summary * Upload directline.js to release * 0.0.2 * 0.0.3-0 * Revert to official package.json * Remove Travis CI * Update entry * Bump restify and webpack with audit fix
1 parent 19bb0c9 commit 8f2b9c8

8 files changed

Lines changed: 10754 additions & 7226 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Continuous deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [16.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
- id: set-version
25+
name: Run npx version-from-git --no-git-tag-version
26+
run: |
27+
npx version-from-git --no-git-tag-version
28+
echo version=`cat package.json | jq -r '.version'` > $GITHUB_OUTPUT
29+
- run: npm clean-install
30+
- run: npm run prepublishOnly
31+
- name: Upload tarball artifact
32+
uses: actions/upload-artifact@v3.1.1
33+
with:
34+
name: bundle
35+
path: ./dist
36+
- run: npm pack
37+
- name: Upload tarball artifact
38+
uses: actions/upload-artifact@v3.1.1
39+
with:
40+
name: tarball
41+
path: ./*.tgz
42+
43+
publish:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
environment: prerelease
47+
48+
steps:
49+
- uses: actions/setup-node@v3
50+
with:
51+
node-version: 16
52+
registry-url: https://registry.npmjs.org/
53+
- name: Download tarball artifact
54+
uses: actions/download-artifact@v3.0.1
55+
with:
56+
name: tarball
57+
- id: get-version
58+
name: Get version
59+
run: |
60+
echo package-name=`tar --extract --file=\`ls ./*.tgz\` --to-stdout package/package.json | jq -r .name` >> $GITHUB_OUTPUT
61+
echo version=`tar --extract --file=\`ls ./*.tgz\` --to-stdout package/package.json | jq -r .version` >> $GITHUB_OUTPUT
62+
- if: ${{ !contains(steps.get-version.outputs.version, '-') }}
63+
name: Validate version
64+
run: |
65+
echo Cannot publish production version
66+
exit 1
67+
- run: npm publish --access public --tag ${{ github.ref_name }} `ls *.tgz`
68+
env:
69+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
70+
- name: Generate job summary
71+
run: echo "NPM package has been published to https://npmjs.com/package/${{ steps.get-version.outputs.package-name }}/v/${{ steps.get-version.outputs.version }}." > $GITHUB_STEP_SUMMARY
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Publish release on push tag
2+
3+
on:
4+
push:
5+
tags: 'v*'
6+
7+
jobs:
8+
build-and-draft:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Use Node.js 16
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 16
17+
cache: 'npm'
18+
- id: get-version
19+
name: Get version
20+
run: echo version=`cat package.json | jq -r '.version'` >> $GITHUB_OUTPUT
21+
- name: Validate version
22+
if: ${{ contains(steps.get-version.outputs.version, '-') }}
23+
run: |
24+
echo Version number must not be a prerelease.
25+
exit 1
26+
- run: npm clean-install
27+
- run: npm run prepublishOnly
28+
- name: Upload tarball artifact
29+
uses: actions/upload-artifact@v3.1.1
30+
with:
31+
name: bundle
32+
path: ./dist
33+
- run: npm pack
34+
- name: Upload tarball artifact
35+
uses: actions/upload-artifact@v3.1.1
36+
with:
37+
name: tarball
38+
path: ./*.tgz
39+
- name: Draft a new release
40+
run: gh release create ${{ github.ref_name }} ./dist/directline.js ./*.tgz --draft --notes-file ./CHANGELOG.md
41+
env:
42+
GH_TOKEN: ${{ github.token }}
43+
44+
publish-package:
45+
environment: production
46+
needs: build-and-draft
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/setup-node@v3
51+
with:
52+
node-version: 16
53+
registry-url: https://registry.npmjs.org/
54+
- name: Download tarball artifact
55+
uses: actions/download-artifact@v3.0.1
56+
with:
57+
name: tarball
58+
- id: get-version
59+
name: Get version
60+
run: |
61+
echo package-name=`tar --extract --file=\`ls ./*.tgz\` --to-stdout package/package.json | jq -r .name` >> $GITHUB_OUTPUT
62+
echo version=`tar --extract --file=\`ls ./*.tgz\` --to-stdout package/package.json | jq -r .version` >> $GITHUB_OUTPUT
63+
- run: npm publish --access public `ls ./*.tgz`
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
- name: Generate job summary
67+
run: echo "NPM package has been published to https://npmjs.com/package/${{ steps.get-version.outputs.package-name }}/v/${{ steps.get-version.outputs.version }}." > $GITHUB_STEP_SUMMARY
68+
69+
publish-release:
70+
needs:
71+
- build-and-draft
72+
- publish-package
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- name: Publish release
77+
run: gh release edit ${{ github.ref_name }} --draft=false --repo ${{ github.repository }}
78+
env:
79+
GH_TOKEN: ${{ github.token }}
80+
- name: Generate job summary
81+
run: echo "GitHub release created at https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}." >> $GITHUB_STEP_SUMMARY
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Pull request validation
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [16.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
- run: npm clean-install
25+
- run: npm run prepublishOnly
26+
- name: Upload tarball artifact
27+
uses: actions/upload-artifact@v3.1.1
28+
with:
29+
name: bundle
30+
path: ./dist
31+
- run: npm pack
32+
- name: Upload tarball artifact
33+
uses: actions/upload-artifact@v3.1.1
34+
with:
35+
name: tarball
36+
path: ./*.tgz
37+
- run: npm test

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.env
2-
dist
3-
lib
4-
node_modules
5-
.vscode
2+
/.vscode
3+
/*.tgz
4+
/dist
5+
/lib
6+
/node_modules

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616

1717
## [Unreleased]
1818

19+
### Changed
20+
21+
- Bumped dependencies, by [@compulim](https://github.com/compulim), in PR [#390](https://github.com/microsoft/BotFramework-DirectLineJS/pull/390)
22+
- Development dependencies
23+
- [`restify@11.0.0`](https://npmjs.com/package/restify)
24+
- [`webpack@5.75.0`](https://npmjs.com/package/webpack)
25+
1926
## [0.15.1] - 2022-02-09
2027

2128
### Changed

0 commit comments

Comments
 (0)