-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update release ci and add github-release (#147)
- Loading branch information
1 parent
a2f5cb8
commit 23ae57e
Showing
2 changed files
with
118 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,62 +3,72 @@ name: ci | |
on: [push, pull_request] | ||
|
||
jobs: | ||
should-skip: | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
# Map a step output to a job output | ||
outputs: | ||
should-skip-job: ${{steps.skip-check.outputs.should_skip}} | ||
steps: | ||
- id: skip-check | ||
uses: fkirc/[email protected] | ||
with: | ||
github_token: ${{github.token}} | ||
|
||
ci: | ||
env: | ||
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }} | ||
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }} | ||
runs-on: ${{ matrix.os }} | ||
needs: should-skip | ||
if: ${{needs.should-skip.outputs.should-skip-job != 'true' || github.ref == 'refs/heads/main'}} | ||
strategy: | ||
# TODO: test IE 11, Legacy Edge, and New Edge on windows-latest | ||
# test Safari on macos-latest | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
test-type: ['unit', 'coverage'] | ||
env: | ||
BROWSER_STACK_USERNAME: ${{secrets.BROWSER_STACK_USERNAME}} | ||
BROWSER_STACK_ACCESS_KEY: ${{secrets.BROWSER_STACK_ACCESS_KEY}} | ||
CI_TEST_TYPE: ${{matrix.test-type}} | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.npm | ||
**/node_modules | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-npm- | ||
${{ runner.os }}- | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Read .nvmrc | ||
- name: read node version from .nvmrc | ||
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | ||
shell: bash | ||
id: nvm | ||
|
||
- name: Install ffmpeg/pulseaudio for firefox on linux w/o browserstack | ||
- name: update apt cache on linux w/o browserstack | ||
run: sudo apt-get update | ||
|
||
- name: install ffmpeg/pulseaudio for firefox on linux w/o browserstack | ||
run: sudo apt-get install ffmpeg pulseaudio | ||
if: ${{ startsWith(matrix.os, 'ubuntu') && !env.BROWSER_STACK_USERNAME }} | ||
|
||
- name: start pulseaudio for firefox on linux w/o browserstack | ||
run: pulseaudio -D | ||
if: ${{ startsWith(matrix.os, 'ubuntu') && !env.BROWSER_STACK_USERNAME }} | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
- name: setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '${{ steps.nvm.outputs.NVMRC }}' | ||
- run: npm i --prefer-offline --no-audit | ||
node-version: '${{steps.nvm.outputs.NVMRC}}' | ||
cache: npm | ||
|
||
# run safari on macos | ||
- name: Run Mac test | ||
run: npm run test -- --browsers Safari | ||
if: ${{ startsWith(matrix.os, 'macos') }} | ||
# turn off the default setup-node problem watchers... | ||
- run: echo "::remove-matcher owner=eslint-compact::" | ||
- run: echo "::remove-matcher owner=eslint-stylish::" | ||
- run: echo "::remove-matcher owner=tsc::" | ||
|
||
# only run ie 11 on windows | ||
- name: Run Windows test | ||
run: npm run test -- --browsers IE | ||
if: ${{ startsWith(matrix.os, 'windows') }} | ||
- name: npm install | ||
run: npm i --prefer-offline --no-audit | ||
|
||
# run chrome/firefox or browserstack in linux | ||
- name: Run linux test | ||
- name: run npm test | ||
uses: GabrielBB/xvfb-action@v1 | ||
with: | ||
run: npm test | ||
if: ${{ startsWith(matrix.os, 'ubuntu') }} | ||
run: npm run test | ||
|
||
- name: coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
files: './test/dist/coverage/coverage-final.json' | ||
fail_ci_if_error: true | ||
if: ${{startsWith(env.CI_TEST_TYPE, 'coverage')}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: github-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: | ||
github-release: | ||
env: | ||
# Set this if you want a netlify example | ||
NETLIFY_BASE: '' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# 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 ::set-output name=NVMRC::$(cat .nvmrc) | ||
shell: bash | ||
id: nvm | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '${{steps.nvm.outputs.NVMRC}}' | ||
cache: npm | ||
|
||
- name: npm install | ||
run: npm i --prefer-offline --no-audit | ||
|
||
- name: build | ||
run: npm run build-prod || npm run build --if-present | ||
|
||
- name: Check if this is a pre-release | ||
run: echo ::set-output name=IS_PRE_RELEASE::$(npx -p not-prerelease is-prerelease && echo "true" || echo "false") | ||
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 ::set-output name=VERSION::$(node -e "process.stdout.write(require('./package.json').version.split('.').join('-'))") | ||
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 |