|
| 1 | +name: "Release version" |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + description: 'Release version' |
| 7 | + required: true |
| 8 | + push: |
| 9 | + tags: |
| 10 | + - 'v*.*' |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Set LD_VERSION |
| 17 | + if: ${{ github.event_name == 'push'}} |
| 18 | + run: echo "LD_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV |
| 19 | + - name: Set LD_VERSION |
| 20 | + if: ${{ github.event_name == 'workflow_dispatch'}} |
| 21 | + run: echo "LD_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV |
| 22 | + |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + - name: Cache pnpm modules |
| 25 | + uses: actions/cache@v3 |
| 26 | + with: |
| 27 | + path: ~/.pnpm-store |
| 28 | + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 29 | + restore-keys: | |
| 30 | + ${{ runner.os }}- |
| 31 | + - uses: pnpm/action-setup@v2.2.2 |
| 32 | + with: |
| 33 | + version: 7.11.0 |
| 34 | + run_install: true |
| 35 | + - name: Use Node.js 16.x |
| 36 | + uses: actions/setup-node@v3.4.1 |
| 37 | + with: |
| 38 | + node-version: 16.x |
| 39 | + cache: "pnpm" |
| 40 | + - name: Build and zip extension artifact |
| 41 | + run: | |
| 42 | + pnpm build -- --zip |
| 43 | + pnpm build --target=firefox-mv2 --zip |
| 44 | +
|
| 45 | + - name: Create Release |
| 46 | + id: create_release |
| 47 | + uses: actions/create-release@v1 |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + with: |
| 51 | + tag_name: v${{ env.LD_VERSION }} |
| 52 | + release_name: v${{ env.LD_VERSION }} |
| 53 | + draft: true |
| 54 | + prerelease: false |
| 55 | + |
| 56 | + - name: Upload Chrome Release Asset |
| 57 | + id: upload-chrome-release-asset |
| 58 | + uses: actions/upload-release-asset@v1 |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + with: |
| 62 | + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 63 | + asset_path: ./build/chrome-mv3-prod.zip |
| 64 | + asset_name: leetcode-editor-extension-chrome-${{ env.LD_VERSION }}.zip |
| 65 | + asset_content_type: application/zip |
| 66 | + |
| 67 | + - name: Upload Firefox Release Asset |
| 68 | + id: upload-firefox-release-asset |
| 69 | + uses: actions/upload-release-asset@v1 |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + with: |
| 73 | + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 74 | + asset_path: ./build/firefox-mv2-prod.zip |
| 75 | + asset_name: leetcode-editor-extension-firefox-${{ env.LD_VERSION }}.zip |
| 76 | + asset_content_type: application/zip |
| 77 | + |
| 78 | +# - name: Browser Platform Publish |
| 79 | +# uses: PlasmoHQ/bpp@v2 |
| 80 | +# with: |
| 81 | +# keys: ${{ secrets.SUBMIT_KEYS }} |
| 82 | +# artifact: build/chrome-mv3-prod.zip |
0 commit comments