Merge pull request #219 from delook-dev/main #23
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-Chrome-Extension | |
| on: | |
| push: | |
| branches: | |
| - production | |
| jobs: | |
| build: | |
| name: Build Chrome Extension | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22.x] | |
| steps: | |
| - name: Checkout Git repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install | |
| # manifest.json의 버전을 자동으로 업데이트 (build 번호만 증가) | |
| - name: Auto bump manifest version + version_name | |
| run: yarn extension-version | |
| # 빌드 실행 | |
| - name: Build project | |
| run: yarn build | |
| # 빌드된 dist + manifest.json 압축 | |
| - name: Archive dist folder into zip | |
| run: zip -r chrome-extension-${{ github.sha }}.zip dist | |
| # zip 파일을 GitHub Actions artifact로 업로드 (다음 job에서 사용) | |
| - name: Upload zip as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrome-extension | |
| path: chrome-extension-${{ github.sha }}.zip | |
| upload: | |
| name: Upload to Chrome Web Store | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| matrix: | |
| node-version: [22.x] | |
| env: | |
| EXTENSION_ID: ${{ secrets.EXTENSION_ID }} | |
| steps: | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # 앞 단계에서 업로드한 artifact 다운로드 | |
| - name: Download built artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: chrome-extension | |
| # Chrome Web Store CLI 설치 | |
| - name: Install chrome-webstore-upload-cli | |
| run: yarn global add chrome-webstore-upload-cli | |
| # 확장 프로그램 업로드 | |
| - name: Upload extension zip | |
| run: | | |
| ZIP_FILE=$(ls *.zip) | |
| chrome-webstore-upload upload \ | |
| --source $ZIP_FILE \ | |
| --extension-id ${{ secrets.EXTENSION_ID }} \ | |
| --client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \ | |
| --client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \ | |
| --refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }} | |
| # 업로드 후 Web Store에 게시(publish) | |
| - name: Publish extension | |
| run: | | |
| chrome-webstore-upload publish \ | |
| --extension-id ${{ secrets.EXTENSION_ID }} \ | |
| --client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \ | |
| --client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \ | |
| --refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }} |