Skip to content

Commit 1707b47

Browse files
migrating to shared ci
1 parent 576e914 commit 1707b47

File tree

5 files changed

+74
-46
lines changed

5 files changed

+74
-46
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ on:
33
push:
44
branches:
55
- master
6-
tags:
7-
- v*
86
pull_request:
97

108
jobs:
@@ -27,46 +25,3 @@ jobs:
2725
- run: npm run lint
2826
- run: npm run test
2927
- run: npm run publish-coverage
30-
npm-release:
31-
#only run this task if a tag starting with 'v' was used to trigger this (i.e. a tagged release)
32-
if: startsWith(github.ref, 'refs/tags/v')
33-
needs: ci
34-
runs-on: ubuntu-latest
35-
env:
36-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37-
steps:
38-
- uses: actions/checkout@master
39-
- uses: actions/setup-node@master
40-
with:
41-
node-version: "14.18.1"
42-
architecture: 'x64' # fix for macos-latest
43-
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ./.npmrc
44-
- run: npm ci
45-
- run: npm run build
46-
#create npm package
47-
- run: npm pack
48-
49-
#create GitHub release
50-
- name: Create GitHub Release
51-
id: create_release
52-
uses: actions/create-release@latest
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
with:
56-
tag_name: ${{ github.ref }}
57-
release_name: ${{ github.ref }}
58-
draft: false
59-
prerelease: false #contains(github.ref, '-beta.') == true
60-
61-
#upload package to GitHub release
62-
- name: Upload GitHub Release Assets
63-
uses: alexellis/upload-assets@0.2.3
64-
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
with:
67-
asset_paths: '["./*.tgz"]'
68-
69-
#If there's a dash followed by an alpha character, this is a prerelease and should be tagged "next". Otherwise tag as "latest"
70-
- run: if [[ "${{ github.ref }}" =~ -[a-zA-Z] ]]; then echo "DIST_TAG=next" >> $GITHUB_ENV; else echo "DIST_TAG=latest" >> $GITHUB_ENV; fi
71-
#upload to npm
72-
- run: npm publish --tag ${{env.DIST_TAG}}
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.18.1"
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
@@ -9,7 +9,8 @@
99
"lint": "eslint \"src/**\"",
1010
"test:nocover": "mocha",
1111
"test": "nyc mocha",
12-
"publish-coverage": "nyc report --reporter=text-lcov | coveralls"
12+
"publish-coverage": "nyc report --reporter=text-lcov | coveralls",
13+
"package": "npm ci && npm run build && npm pack"
1314
},
1415
"mocha": {
1516
"spec": "src/**/*.spec.ts",

0 commit comments

Comments
 (0)