From 8c932013eee9cb41f939f11fd4e61fc87370357d Mon Sep 17 00:00:00 2001 From: "Alex.Liu" Date: Fri, 2 Jun 2023 04:23:34 +0800 Subject: [PATCH] feat: github action to zip extension and upload to release assets --- .github/workflows/publish.yml | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 98964e5..79c0473 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,9 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 @@ -36,17 +39,29 @@ jobs: publish_dir: ./app/bot/telegram-cl/dist, ./app/extension/chrome/dist full_commit_message: ${{ github.event.head_commit.message }} - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v3 + - name: Zip extension + uses: vimtor/action-zip@v1.1 with: - node-version: 18.x + files: ./app/extension/chrome/dist + recursive: false + dest: ./chrome-extension.zip - run: npx changelogithub # or changelogithub@0.12 if ensure the stable result env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get latest release id + id: get-release-id + run: echo "release_id=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq '.id' | sed 's/\"//g')" >> $GITHUB_OUTPUT + + - name: Upload Release Asset + id: upload-release-asset + uses: LarchLiu/upload-release-assets@v1.2.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + repository: ${{ github.repository }} + release_id: ${{ steps.get-release-id.outputs.release_id }} + asset_path: ./chrome-extension.zip + asset_name: chrome-extension.zip + asset_content_type: application/zip