Skip to content

Commit

Permalink
Merge branch 'main' into fix/rimraf_uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
nokhnaton committed Oct 24, 2024
2 parents 130c3f6 + 14216c6 commit 56a775e
Show file tree
Hide file tree
Showing 49 changed files with 2,639 additions and 7,680 deletions.
32 changes: 0 additions & 32 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- 'master'
- 'main'
pull_request:

jobs:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/preview-comment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Comment preview environment URL

on:
# pull_request_target を使うにあたって https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ の一読を推奨
pull_request_target:
types:
- opened

permissions:
pull-requests: write

jobs:
comment:
name: Comment preview environment URL
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const prod = `https://${context.payload.pull_request.number}-prod.portfolio-preview.trapti.tech/`
const dev = `https://${context.payload.pull_request.number}-dev.portfolio-preview.trapti.tech/`
const msg = `
Preview (prod) → ${prod}
Preview (dev) → ${dev}
`
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: msg
});
72 changes: 72 additions & 0 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: preview

on:
# pull_request_target を使うにあたって https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ の一読を推奨
pull_request_target:

permissions:
packages: write

env:
IMAGE_NAME: traportfolio-ui

jobs:
# API生成部分をDockerのビルド部分から分離
genApi:
name: Generate APIs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run gen-api
- uses: actions/upload-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated

build-preview-image:
name: Build Preview Image
needs:
- genApi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: traptitech
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated

# Docker 内でビルドを行うことで、write perm つきでの任意コード実行を避ける
# workflow 自体の改竄はないが、悪意のあるソースコードが入った場合に secret が抽出される可能性があるためである
- name: Build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/traptitech/${{ env.IMAGE_NAME }}:preview-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}
cache-from: type=registry,ref=ghcr.io/traptitech/${{ env.IMAGE_NAME }}:buildcache
6 changes: 3 additions & 3 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Build image (master)
name: Build image (main)

on:
push:
branches:
- master
- main

env:
IMAGE_NAME: traportfolio-ui
IMAGE_TAG: master
IMAGE_TAG: main

jobs:
genApi:
Expand Down
43 changes: 43 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import globals from 'globals'
import eslint from '@eslint/js'
import tsESLint from 'typescript-eslint'
import eslintPluginVue from 'eslint-plugin-vue'

const commonLint = {
languageOptions: {
globals: {
...globals.browser
}
}
}

const vueLint = {
files: ['*.vue', '**/*.vue'],
languageOptions: {
parserOptions: {
parser: "@typescript-eslint/parser"
}
},
rules: {
'no-console': 'warn',
'no-debugger': 'warn',

'no-restricted-imports': [
'error',
{
name: '/@/lib/apis/generated',
message: 'Please use /@/lib/apis instead.'
}
],

'vue/custom-event-name-casing': ['error', 'camelCase']
}
}

export default [
eslint.configs.recommended,
...tsESLint.configs.recommended,
...eslintPluginVue.configs['flat/recommended'],
commonLint,
vueLint
]
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
<meta property="og:site_name" content="traPortfolio" />
<meta
property="og:description"
content="東京工業大学デジタル創作同好会traPに所属する各部員の活動内容をまとめたポートフォリオサービスです"
content="東京科学大学デジタル創作同好会traPに所属する各部員の活動内容をまとめたポートフォリオサービスです"
/>
<meta property="og:locale" content="ja_JP" />
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@traPtitech">
<meta name="twitter:title" content="traPortfolio">
<meta name="twitter:description" content="東京工業大学デジタル創作同好会traPに所属する各部員の活動内容をまとめたポートフォリオサービスです">
<meta name="description" content="東京工業大学デジタル創作同好会traPに所属する各部員の活動内容をまとめたポートフォリオサービスです" />
<meta name="twitter:description" content="東京科学大学デジタル創作同好会traPに所属する各部員の活動内容をまとめたポートフォリオサービスです">
<meta name="description" content="東京科学大学デジタル創作同好会traPに所属する各部員の活動内容をまとめたポートフォリオサービスです" />
<title>traPortfolio</title>
</head>
<body>
Expand Down
Loading

0 comments on commit 56a775e

Please sign in to comment.