Fix React Server Components RCE vulnerability #36
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Extension | |
| on: | |
| pull_request: | |
| types: [closed] | |
| jobs: | |
| build: | |
| if: ${{ contains(github.event.pull_request.title, '[EXTENSION]') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Enable Corepack & Prepare pnpm | |
| run: | | |
| corepack enable | |
| corepack prepare pnpm@latest --activate | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Backup original manifest | |
| run: | | |
| cp apps/extension/manifest.json apps/extension/manifest.json.backup | |
| - name: Bump version | |
| run: | | |
| cd apps/extension | |
| # 현재 버전 읽기 | |
| CURRENT_VERSION=$(node -p "JSON.parse(require('fs').readFileSync('manifest.json', 'utf8')).version") | |
| echo "Current version: $CURRENT_VERSION" | |
| # 버전 증가 (마지막 숫자 증가) | |
| NEW_VERSION=$(node -p " | |
| const version = '$CURRENT_VERSION'; | |
| const parts = version.split('.'); | |
| const lastPart = parseInt(parts[parts.length - 1]); | |
| parts[parts.length - 1] = (lastPart + 1).toString(); | |
| parts.join('.'); | |
| ") | |
| echo "New version: $NEW_VERSION" | |
| # manifest.json 업데이트 | |
| node -p " | |
| const fs = require('fs'); | |
| const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf8')); | |
| manifest.version = '$NEW_VERSION'; | |
| fs.writeFileSync('manifest.json', JSON.stringify(manifest, null, 2)); | |
| " | |
| echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| - name: Create .env.production file | |
| run: | | |
| echo "${{ secrets.EXTENSION_ENV }}" > apps/extension/.env.production | |
| - name: Build extension | |
| run: | | |
| pnpm build:extension | |
| - name: Create zip file | |
| run: | | |
| cd apps/extension | |
| # 필요한 파일들만 포함하여 zip 생성 | |
| zip -r extension.zip \ | |
| manifest.json \ | |
| service-worker.js \ | |
| .env.production \ | |
| dist/ \ | |
| public/ \ | |
| - name: Upload & release | |
| uses: mnao305/chrome-extension-upload@v5.0.0 | |
| with: | |
| file-path: apps/extension/extension.zip | |
| extension-id: ${{ secrets.EXTENSION_ID }} | |
| client-id: ${{ secrets.CLIENT_ID }} | |
| client-secret: ${{ secrets.CLIENT_SECRET }} | |
| refresh-token: ${{ secrets.REFRESH_TOKEN }} | |
| publish-target: trustedTesters | |
| - name: Commit version bump | |
| if: success() | |
| run: | | |
| git config --local user.email "${{ secrets.EMAIL }}" | |
| git config --local user.name "${{ secrets.USERNAME }}" | |
| git add apps/extension/manifest.json | |
| git commit -m "chore: bump extension version to ${{ env.VERSION }} [skip ci]" | |
| git push origin HEAD:dev | |
| - name: Restore original manifest on failure | |
| if: failure() | |
| run: | | |
| if [ -f apps/extension/manifest.json.backup ]; then | |
| cp apps/extension/manifest.json.backup apps/extension/manifest.json | |
| echo "Original manifest restored" | |
| fi |