Skip to content

Commit

Permalink
chore: add github release ci action (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored Aug 24, 2021
1 parent 6ff42f4 commit abe7936
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/github-release.yml
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: 'https://muxjs.netlify.app/'
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

0 comments on commit abe7936

Please sign in to comment.