From ecde4943328fb468716d3aa2669c1c283496b096 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 24 Jan 2024 15:36:34 +0100 Subject: [PATCH] deploy workflow --- .github/workflows/deploying.yml | 108 ++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 .github/workflows/deploying.yml diff --git a/.github/workflows/deploying.yml b/.github/workflows/deploying.yml new file mode 100644 index 0000000..6058b65 --- /dev/null +++ b/.github/workflows/deploying.yml @@ -0,0 +1,108 @@ +name: Deploying + +on: + push: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install pnpm packages + run: pnpm install + + - name: Build chrome project + run: pnpm run build + + - name: Package for chrome + run: pnpm run package + + - name: Build firefox project + run: pnpm run build:firefox + + - name: Package for firefox + run: pnpm run package:firefox + + - name: Upload chrome package + uses: actions/upload-artifact@v4 + with: + name: chrome + path: ./build/chrome-mv3-prod.zip + + - name: Upload firefox package + uses: actions/upload-artifact@v4 + with: + name: firefox + path: ./build/firefox-mv3-prod.zip + + release: + name: Release + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download Chrome artifact + uses: actions/download-artifact@v4 + with: + name: chrome + path: ./chrome.zip + + - name: Download Firefox artifact + uses: actions/download-artifact@v4 + with: + name: firefox + path: ./firefox.zip + + - name: Get version + id: package-version + uses: martinbeentjes/npm-get-version-action@main + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.package-version.outputs.current-version }} + release_name: Extension v${{ steps.package-version.outputs.current-version }} + draft: false + prerelease: false + + - name: Upload Chrome release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./chrome.zip + asset_name: chrome.zip + asset_content_type: application/zip + + - name: Upload Firefox release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./firefox.zip + asset_name: firefox.zip + asset_content_type: application/zip