Skip to content

chore(deps): update devdependencies (major) #867

chore(deps): update devdependencies (major)

chore(deps): update devdependencies (major) #867

Workflow file for this run

name: CI and CD
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
jobs:
lint:
name: Run ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Node.js with Volta
uses: ./.github/actions/setup-node
with:
NODE_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN_FOR_GITHUBPKG }}
- name: Run ESLint
run: yarn lint
format:
name: Run Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Node.js with Volta
uses: ./.github/actions/setup-node
with:
NODE_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN_FOR_GITHUBPKG }}
- name: Run Prettier
run: yarn format
test:
name: Run Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Node.js with Volta
uses: ./.github/actions/setup-node
with:
NODE_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN_FOR_GITHUBPKG }}
- name: Run coverage tests
run: yarn test:coverage
- name: Edit result file
run: tail -n +2 coverage/result-jest.txt | head -n -1 > result.txt
- name: Write coverages to summary
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs").promises;
const jest = await fs.readFile("./result.txt").then((b) => b.toString());
const output = `\n${jest}`;
await core.summary
.addHeading('Jest Coverages')
.addRaw(output)
.write();
build:
name: Run Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Node.js with Volta
uses: ./.github/actions/setup-node
with:
NODE_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN_FOR_GITHUBPKG }}
- name: Restore Next.js build cache
uses: actions/cache@v3
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Make envfile
run: |
cat > .env <<EOD
NODE_ENV=${{ vars.NODE_ENV }}
NEXT_PUBLIC_BACKEND_API_URL=${{ secrets.NEXT_PUBLIC_BACKEND_API_URL }}
NEXT_PUBLIC_MS_APP_CLIENT_ID=${{ secrets.NEXT_PUBLIC_MS_APP_CLIENT_ID }}
NEXT_PUBLIC_MS_APP_REDIRECT_URL=${{ vars.NEXT_PUBLIC_MS_APP_REDIRECT_URL }}
EOD
- name: Run build
run: yarn build
- uses: actions/upload-artifact@v3
with:
name: output
path: out
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
deployments: write
needs:
- lint
- format
- test
- build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: output
path: out
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
id: cf
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
accountId: 9e9e88e2b19878c4a911c3c8a715a168
projectName: seichi-portal
directory: out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Output short git SHA
id: sha
if: always() && github.event_name == 'pull_request'
run: |
SHORT_SHA=$(git log --format='%h' -n 1)
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT
- name: Output deployment status
id: content
if: always() && github.event_name == 'pull_request'
run: |
outputStatus() { echo "CONTENT=$1" >> $GITHUB_OUTPUT; }
if [ $STATUS = 'success' ]; then
outputStatus "✅ Deployment succeeded."
else
outputStatus "🚫 Deployment failed."
fi
env:
STATUS: ${{ steps.cf.outcome }}
- name: Notify deployment status and its URL
uses: actions-cool/maintain-one-comment@v3
if: always() && github.event_name == 'pull_request'
with:
body: |
## Deploying with <a href="https://pages.dev"><img alt="Cloudflare Pages" src="https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png" width="16"></a> Cloudflare Pages
<table>
<tr>
<td><strong>Latest commit:</strong> </td>
<td><code>${{ steps.sha.outputs.SHORT_SHA }}</code></td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td>${{ steps.content.outputs.CONTENT }}</td>
</tr>
<tr>
<td><strong>Deployment URL:</strong></td>
<td><a href="${{ steps.cf.outputs.url }}">${{ steps.cf.outputs.url }}</a></td>
</tr>
</table>
body-include: '<!-- Created by actions-cool/maintain-one-comment -->'