add runRelease in composable #7
Workflow file for this run
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: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
base_branch: | |
description: 'Name of branch to base build on' | |
type: string | |
required: false | |
default: 'master' | |
build_branch: | |
description: 'Name of branch to commit build to' | |
type: string | |
required: false | |
default: 'build' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# リポジトリから全データをチェックアウト | |
- name: Checkout this repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets['GITHUB_TOKEN'] }} | |
ref: ${{ inputs.base_branch || 'master' }} | |
fetch-depth: 0 | |
# Git configをGitHub ActionsのBotアカウントに設定 | |
- name: Set local git config user details | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
# 再度チェックアウトし、ビルド用ブランチにベースブランチをマージ(ビルド用ブランチが無いと失敗する可能性があるが続行) | |
- name: (Re)checkout both branches and merge main into build | |
continue-on-error: true | |
run: | | |
git checkout ${{ inputs.base_branch || 'master' }} | |
git checkout ${{ inputs.build_branch || 'build' }} | |
git merge ${{ inputs.base_branch || 'master' }} | |
# Node.jsをセットアップ | |
- name: Node.js setup | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# NPMのキャッシュ用設定をセット | |
- name: Set NPM cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
# NPMを最新バージョンにアップデート | |
- name: Update NPM installation | |
run: npm install -g npm@latest | |
# 依存パッケージをインストール | |
- name: Install NPM dependencies | |
run: npm ci | |
# ビルドを実施 | |
- name: Build | |
run: | | |
npm run clean | |
npm run build | |
# ビルドしたファイルをコミットする | |
# 変更されたファイルがない場合失敗する場合があるが続行 | |
- name: Commit built files | |
id: commit | |
continue-on-error: true | |
run: | | |
git add -f dashboard extension graphics shared | |
git commit -m "Built files" -a | |
# ビルド用ブランチにプッシュ | |
- name: Push built files to build branch | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets['GITHUB_TOKEN'] }} | |
branch: ${{ inputs.build_branch || 'build' }} |