Build #34
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
name: Build | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Create a release build' | |
required: false | |
type: boolean | |
push: | |
branches: | |
- 'main' | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- 'action.yaml' | |
- 'package-lock.json' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: node-${{ hashFiles('package-lock.json') }} | |
restore-keys: node- | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Create release build | |
if: ${{ inputs.release }} | |
run: | | |
npm install | |
npm run build | |
- name: Create debug build | |
if: ${{ !inputs.release }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Actions" | |
git fetch origin build | |
git switch build | |
git merge main | |
npm install | |
npm run build | |
- name: Push to GitHub | |
uses: EndBug/[email protected] | |
with: | |
add: '-f ./dist' | |
author_name: 'GitHub Actions' | |
author_email: '[email protected]' | |
message: 'build: Build action' |