Skip to content

Workflow file for this run

name: Build and Release
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
minor-wording: 'add,Adds,new'
major-wording: 'MAJOR,cut-major'
patch-wording: 'patch,fixes'
rc-wording: 'RELEASE,alpha'
default: 'patch'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Run build
run: npm run build
- name: List files in dist
id: list_files
run: |
files=""
for file in dist/*; do
[[ -f $file ]] || continue
files="$files $file"
done
echo "::set-output name=files::$files"
- name: Determine TAG_NAME
run: |
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
draft: false
prerelease: false
- name: Upload Release Asset
run: |
for file in ${{ steps.list_files.outputs.files }}
do
curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: $(file -b --mime-type $file)" \
--data-binary @$file \
"${{ steps.create_release.outputs.upload_url }}?name=$(basename $file)"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}