-
Notifications
You must be signed in to change notification settings - Fork 424
76 lines (65 loc) · 2.54 KB
/
release.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
65
66
67
68
69
70
71
72
73
74
75
name: release
on:
push:
tags:
# match semver versions
- "v[0-9]+.[0-9]+.[0-9]+"
# match semver pre-releases
- "v[0-9]+.[0-9]+.[0-9]+-*"
jobs:
release:
env:
NETLIFY_BASE: 'videojs-http-streaming.netlify.app'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# We neeed to fetch the entire history as conventional-changelog needs
# access to any number of git commits to build the changelog.
with:
fetch-depth: 0
- name: read node version from .nvmrc
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
shell: bash
id: nvm
- name: setup node
uses: actions/setup-node@v3
with:
node-version: '${{steps.nvm.outputs.NVMRC}}'
cache: npm
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'
- name: npm install
run: npm i --prefer-offline --no-audit
# publish runs build for us via a prepublishOnly script
- name: npm release
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check if this is a pre-release
run: echo "IS_PRE_RELEASE=$(npx -p not-prerelease is-prerelease && echo "true" || echo "false")" >> $GITHUB_OUTPUT
id: pre-release-check
- name: truncate CHANGELOG.md so that we can get the current versions changes only
run: truncate -s 0 CHANGELOG.md
- name: Generate current release changelog
run: npx -p @videojs/update-changelog vjs-update-changelog --run-on-prerelease
- name: get dashed package version for netlify
run: echo "VERSION=$(node -e "process.stdout.write(require('./package.json').version.split('.').join('-'))")" >> $GITHUB_OUTPUT
id: get-version
shell: bash
if: env.NETLIFY_BASE != ''
- name: add netlify preview to release notes
run: |
echo "" >> CHANGELOG.md
echo "[netlify preview for this version](https://v${{steps.get-version.outputs.VERSION}}--${{env.NETLIFY_BASE}})" >> CHANGELOG.md
if: env.NETLIFY_BASE != ''
- name: Create Github release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
token: ${{github.token}}
prerelease: ${{steps.pre-release-check.outputs.IS_PRE_RELEASE}}
files: |
dist/**/*.js
dist/**/*.css
discussion_category_name: Releases