-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (62 loc) · 1.77 KB
/
npm-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
on:
release:
types: [created]
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
scope: '@6degrees'
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
release:
needs: publish-npm
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get version number
id: version
run: echo "::set-output name=version::$(node -p -e "require('./package.json').version")"
- name: Get the latest tag
id: get_tag
run: echo ::set-output name=TAG::$(git describe --tags $(git rev-list --tags --max-count=1))
- name: Set release notes
id: set_release_notes
run: |
#!/bin/bash
release_notes=$(git log --pretty=format:'%s' -n 1)
echo "RELEASE_NOTES=$release_notes" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
Changes in this Release
- ${{ env.RELEASE_NOTES }}
draft: false
prerelease: false