Skip to content

Netlifyにデプロイするワークフローを追加した #4

Netlifyにデプロイするワークフローを追加した

Netlifyにデプロイするワークフローを追加した #4

Workflow file for this run

name: Deploy Netlify
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: main
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Install Netlify CLI
run: npm install -g netlify-cli
- name: Deploy to Netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
npx netlify deploy --prod --build --message "${{ github.event.head_commit.message || github.event.pull_request.title }}"
else
npx netlify deploy --build --message "${{ github.event.head_commit.message || github.event.pull_request.title }}"
fi