Skip to content

Commit c8bc351

Browse files
committed
chore: add GitHub Actions workflows for publishing and verification
1 parent 8e50452 commit c8bc351

File tree

5 files changed

+91
-25
lines changed

5 files changed

+91
-25
lines changed

.github/workflows/publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
SEMVER_TYPE:
7+
description: 'Semver type'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
jobs:
17+
publish-npm:
18+
environment: Public NPM registry
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
id-token: write
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
ssh-key: ${{ secrets.DEPLOY_KEY }}
27+
- name: Check if on main branch
28+
run: |
29+
if [[ $GITHUB_REF != 'refs/heads/main' ]]; then
30+
echo "This workflow must run on the 'main' branch."
31+
exit 1
32+
fi
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 'lts/*'
36+
cache: 'npm'
37+
registry-url: 'https://registry.npmjs.org'
38+
scope: '@workfront'
39+
- run: npm ci --no-fund --no-audit
40+
- name: Bump package version
41+
run: |
42+
git config --global user.name 'github-actions[bot]'
43+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
44+
echo "Bumping version as ${{ github.event.inputs.SEMVER_TYPE }}"
45+
npm version --no-commit-hooks ${{ github.event.inputs.SEMVER_TYPE }}
46+
git push origin main --follow-tags
47+
- name: Publish to NPM
48+
run: npm publish --provenance --access public
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Draft release
53+
run: |
54+
VERSION=$(node -p "require('./package.json').version")
55+
gh release create v$VERSION --generate-notes --draft --verify-tag --fail-on-no-commits
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
VERSION: ${{ inputs.next_version }}

.github/workflows/verify.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Verify
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: lts/*
20+
cache: 'npm'
21+
registry-url: 'https://registry.npmjs.org'
22+
scope: '@workfront'
23+
- run: npm ci --no-fund --no-audit
24+
- run: npm run build

.travis.yml

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

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# workfront-objcodes
1+
# @workfront/objcodes
22

3-
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![Apache v2 License][license-image]][license-url] [![Build Status][travis-image]][travis-url]
3+
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![Apache v2 License][license-image]][license-url]
44

55
Definitions for object codes to be used with Workfront API
66

@@ -20,22 +20,22 @@ The code inside `dist/objcodes.js` is in ES5, so you don't need transpilers to u
2020
### Examples
2121

2222
```javascript
23-
import {Baseline} from 'workfront-objcodes'
23+
import {Baseline} from '@workfront/objcodes'
2424

2525
// output 'BLIN'
2626
console.log(Baseline)
2727
```
2828

2929
```javascript
30-
import * as ObjCodes from 'workfront-objcodes'
30+
import * as ObjCodes from '@workfront/objcodes'
3131

3232
// outputs 'BLIN'
3333
console.log(ObjCodes.Baseline)
3434
```
3535

3636
```typescript
3737
// TypeScript type definitions are bundled
38-
import {TObjCode, OpTask} from 'workfront-objcodes'
38+
import {TObjCode, OpTask} from '@workfront/objcodes'
3939

4040
// TS2322: Type '"FOO"' is not assignable to type 'TObjCode'
4141
const myObjCode: TObjCode = 'FOO'
@@ -65,9 +65,6 @@ See the top-level file `LICENSE` and
6565
[license-image]: http://img.shields.io/badge/license-APv2-blue.svg?style=flat
6666
[license-url]: LICENSE
6767

68-
[npm-url]: https://www.npmjs.org/package/workfront-objcodes
69-
[npm-version-image]: https://img.shields.io/npm/v/workfront-objcodes.svg?style=flat
70-
[npm-downloads-image]: https://img.shields.io/npm/dm/workfront-objcodes.svg?style=flat
71-
72-
[travis-url]: https://travis-ci.org/Workfront/workfront-objcodes
73-
[travis-image]: https://img.shields.io/travis/Workfront/workfront-objcodes.svg?style=flat
68+
[npm-url]: https://www.npmjs.org/package/@workfront/objcodes
69+
[npm-version-image]: https://img.shields.io/npm/v/@workfront/objcodes.svg?style=flat
70+
[npm-downloads-image]: https://img.shields.io/npm/dm/@workfront/objcodes.svg?style=flat

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "workfront-objcodes",
2+
"name": "@workfront/objcodes",
33
"version": "1.27.0",
44
"description": "Definitions for all constants which can be used to interact with Workfront API",
55
"main": "dist/umd/objcodes.js",

0 commit comments

Comments
 (0)