Skip to content

Commit cfa413a

Browse files
migrating to shared ci
1 parent 212bc3c commit cfa413a

File tree

5 files changed

+74
-42
lines changed

5 files changed

+74
-42
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,3 @@ jobs:
1919
- run: npm ci
2020
- run: npm run preversion
2121
- run: npm run publish-coverage
22-
npm-release:
23-
#only run this task if a tag starting with 'v' was used to trigger this (i.e. a tagged release)
24-
if: startsWith(github.ref, 'refs/tags/v')
25-
needs: ci
26-
runs-on: ubuntu-latest
27-
env:
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29-
steps:
30-
- uses: actions/checkout@master
31-
- uses: actions/setup-node@master
32-
with:
33-
node-version: "14.19.0"
34-
architecture: 'x64' # fix for macos-latest
35-
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ./.npmrc
36-
- run: npm ci
37-
- run: npm run build
38-
#create npm package
39-
- run: npm pack
40-
41-
#create GitHub release
42-
- name: Create GitHub Release
43-
id: create_release
44-
uses: actions/create-release@latest
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
with:
48-
tag_name: ${{ github.ref }}
49-
release_name: ${{ github.ref }}
50-
draft: false
51-
prerelease: false #contains(github.ref, '-beta.') == true
52-
53-
#upload package to GitHub release
54-
- name: Upload GitHub Release Assets
55-
uses: alexellis/upload-assets@0.2.3
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
with:
59-
asset_paths: '["./*.tgz"]'
60-
61-
#upload to npm
62-
- run: npm publish
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Initialize Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
type: string
8+
description: "The branch to create the release from"
9+
default: "master"
10+
required: true
11+
releaseType:
12+
type: choice
13+
description: "The type of release: major, minor, or patch"
14+
required: true
15+
default: "patch"
16+
options:
17+
- major
18+
- minor
19+
- patch
20+
installDependencies:
21+
type: boolean
22+
description: "Install latest RokuCommunity dependencies"
23+
required: true
24+
default: true
25+
26+
jobs:
27+
run:
28+
uses: rokucommunity/workflows/.github/workflows/initialize-release.yml@master
29+
with:
30+
branch: ${{ github.event.inputs.branch }}
31+
releaseType: ${{ github.event.inputs.releaseType }}
32+
installDependencies: ${{ github.event.inputs.installDependencies }}
33+
secrets: inherit
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Make Release Artifacts
2+
3+
on:
4+
pull_request:
5+
types:
6+
- reopened
7+
- opened
8+
- synchronize
9+
paths:
10+
- 'package.json'
11+
- 'package-lock.json'
12+
13+
jobs:
14+
run:
15+
if: startsWith( github.head_ref, 'release/')
16+
uses: rokucommunity/workflows/.github/workflows/make-release-artifacts.yml@master
17+
with:
18+
branch: ${{ github.event.pull_request.head.ref }}
19+
node-version: "14.19.0"
20+
artifact-paths: "./*.tgz" # "*.vsix"
21+
secrets: inherit
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Release
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
paths:
8+
- 'package.json'
9+
- 'package-lock.json'
10+
11+
jobs:
12+
run:
13+
if: startsWith( github.head_ref, 'release/') && (github.event.pull_request.merged == true)
14+
uses: rokucommunity/workflows/.github/workflows/publish-release.yml@master
15+
with:
16+
release-type: "npm" # "vsce"
17+
ref: ${{ github.event.pull_request.merge_commit_sha }}
18+
secrets: inherit

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"publish-coverage": "nyc report --reporter=text-lcov | coveralls",
1616
"format-github": "ts-node scripts/format-github.ts",
1717
"format-github-compare": "ts-node scripts/format-github.ts --compare",
18-
"cli": "SET TS_NODE_TYPE_CHECK=false && ts-node src/cli.ts"
18+
"cli": "SET TS_NODE_TYPE_CHECK=false && ts-node src/cli.ts",
19+
"package": "npm ci && npm run build && npm pack"
1920
},
2021
"bin": {
2122
"bsfmt": "dist/cli.js",

0 commit comments

Comments
 (0)