From e087a0d6ef53db664930532fa44cbf9a692dca6d Mon Sep 17 00:00:00 2001 From: Guillaume <71637165+GuiEpi@users.noreply.github.com> Date: Thu, 14 Mar 2024 05:07:17 +0100 Subject: [PATCH] docs: Add examples for GitHub Actions (#540) Co-authored-by: Aaron --- docs/guide/publishing.md | 51 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/docs/guide/publishing.md b/docs/guide/publishing.md index 4605cd9c..15f255bd 100644 --- a/docs/guide/publishing.md +++ b/docs/guide/publishing.md @@ -64,12 +64,59 @@ See the [Firefox Addon Store](#firefox-addon-store) section for more details abo ## GitHub Action -Here's an example of a GitHub Action to automate submitting new versions of your extension for review. Ensure that you've added all required secrets used in the workflow to the repo's settings. +Here's an example of a GitHub Action that submits new versions of an extension for review. Ensure that you've added all required secrets used in the workflow to the repo's settings. ```yml -# TODO +name: Release + +on: + workflow_dispatch: + +jobs: + submit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v3 + with: + version: 'latest' + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Zip extensions + run: | + pnpm zip + pnpm zip:firefox + + - name: Submit to stores + run: | + pnpm wxt submit \ + --chrome-zip .output/*-chrome.zip \ + --firefox-zip .output/*-firefox.zip --firefox-sources-zip .output/*-sources.zip + env: + CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} + CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} + CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} + CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} + FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} + FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }} + FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }} ``` +The action above lays the foundation for a basic workflow, including `zip` and `submit` steps. To further enhance your GitHub Action and delve into more complex scenarios, consider exploring the following examples from real projects. They introduce advanced features such as version management, changelog generation, and GitHub releases, tailored for different needs: + +- [`aklinker1/github-better-line-counts`](https://github.com/aklinker1/github-better-line-counts/blob/main/.github/workflows/submit.yml) - Conventional commits, automated version bump and changelog generation, triggered manually, optional dry run for testing +- [`GuiEpi/plex-skipper`](https://github.com/GuiEpi/plex-skipper/blob/main/.github/workflows/deploy.yml) - Triggered automatically when `package.json` version is changed, creates and uploads artifacts to GitHub release. + +> These examples are designed to provide clear insights and are a good starting point for customizing your own workflows. Feel free to explore and adapt them to your project needs. + ## Stores ### Chrome Web Store