Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

開発環境最新化 #135

Merged
merged 7 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/common/setup-node-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Setup Node.js
description: Setup Node.js and pnpm

runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
run_install: false

- name: Get pnpm store path
id: pnpm-store
shell: bash
run: echo "store_path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Setup Node.js
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: package.json

- name: Restore pnpm cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ steps.pnpm-store.outputs.store_path }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies
shell: bash
run: pnpm install --frozen-lockfile

- name: Save pnpm cache if main branch
if: github.ref_name == 'main'
id: save-pnpm-cache
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ steps.pnpm-store.outputs.store_path }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
astro:
- changed-files:
- any-glob-to-any-file: "src/**"

CI:
- changed-files:
- any-glob-to-any-file:
- ".github/workflows/**"
- ".github/labeler.yml"
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
paths:
- ".github/workflows/ci.yml"
- "src/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
eslint:
name: ESLint
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Run ESLint
run: pnpm run lint:check

tsc:
name: tsc
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Run tsc
run: pnpm run typecheck

prettier:
name: Prettier
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Run Prettier
run: pnpm run format:check
112 changes: 112 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Deploy to Cloudflare Pages

on:
push:
branches:
- main
- beta
paths-ignore:
- ".github/**"
- "!.github/workflows/deploy.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
eslint:
name: ESLint
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Run ESLint
run: pnpm run lint:check

tsc:
name: tsc
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Run tsc
run: pnpm run typecheck

prettier:
name: Prettier
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Run Prettier
run: pnpm run format:check

deploy:
name: Build and Deploy Astro App
needs: [eslint, tsc, prettier]
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm

- name: Restore cached Astro Assets
id: restore-astro-assets
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
.astro-cache
key: ${{ runner.os }}-astro-assets-${{ hashFiles('.astro-cache/assets/**') }}
restore-keys: |
${{ runner.os }}-astro-assets-

- name: Build
run: pnpm run build
env:
CLOUDINARY_CLOUD_NAME: ${{secrets.CLOUDINARY_CLOUD_NAME }}
CLOUDINARY_API_KEY: ${{secrets.CLOUDINARY_API_KEY }}
CLOUDINARY_API_SECRET: ${{secrets.CLOUDINARY_API_SECRET }}

SHOW_DRAFT_POST: ${{ github.ref_name != 'main' && github.ref_name != 'beta' }}

- name: Cache Astro Assets
id: cache-astro-assets
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
.astro-cache
key: ${{ runner.os }}-astro-assets-${{ hashFiles('.astro-cache/assets/**') }}

- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@b2a0191ce60d21388e1a8dcc968b4e9966f938e1 # v3.11.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy
81 changes: 0 additions & 81 deletions .github/workflows/pages.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/pr-helper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PR Helper

on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
label:
name: Auto PR Label
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0

assign:
name: Auto PR Assign
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
pull-requests: write
repository-projects: read
if: endsWith(github.actor, '[bot]') == false && github.event.pull_request.assignee == null
steps:
- name: Assign Author to PR
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh pr edit ${{ github.event.number }} --add-assignee ${{ github.actor }}
Loading