Skip to content

test

test #125

name: 'build-and-deploy'
on:
push:
branches:
- 'deploy/**'
- master
- develop-hw
- develop2
- develop
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
env:
NODE_OPTIONS: '--max-old-space-size=4096'
TOOL_NODE_FLAGS: '--max-old-space-size=4096'
with:
node-version: 20
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 9
run_install: true
- name: entry build
env:
NODE_OPTIONS: '--max-old-space-size=4096'
TOOL_NODE_FLAGS: '--max-old-space-size=4096'
run: pnpm prod
- name: Define branch name
id: target_branch
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
- uses: haya14busa/action-cond@v1
id: deploy_branch
with:
cond: ${{ steps.target_branch.outputs.branch == 'master' }}
if_true: 'build'
if_false: dist/${{ steps.target_branch.outputs.branch }}
- name: Execute build.sh
run: |
sh ./scripts/build.sh
- name: Execute deploy.sh
run: |
sh ./scripts/deploy.sh
- name: Push Changes into build branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
directory: ./build
branch: ${{ steps.deploy_branch.outputs.value }}