feat(extension): restrict attachments to images only and add DeepSeek… #6
Workflow file for this run
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: huntly extension release workflow | |
| on: | |
| push: | |
| tags: [ 'ext/v*.*.*' ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| create-release: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_id: ${{ steps.create-release.outputs.id }} | |
| release_upload_url: ${{ steps.create-release.outputs.upload_url }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| # Extract version from tag (ext/v1.0.0 -> 1.0.0) | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG_NAME#ext/v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| - name: Get tag message | |
| id: tag | |
| run: | | |
| git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| echo "message<<EOF" >> $GITHUB_OUTPUT | |
| echo "$(git tag -l --format='%(contents)' $TAG_NAME)" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create-release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| draft: true | |
| name: Extension ${{ steps.get_version.outputs.version }} | |
| tag: ${{ steps.get_version.outputs.tag_name }} | |
| body: "${{ steps.tag.outputs.message }}" | |
| build-upload: | |
| runs-on: ubuntu-latest | |
| needs: create-release | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20.10.0" | |
| cache: "yarn" | |
| cache-dependency-path: "app/extension/yarn.lock" | |
| - name: Setup yarn | |
| run: npm install -g yarn@1.22.19 | |
| - name: Install extension dependencies | |
| run: | | |
| cd app/extension | |
| yarn install --frozen-lockfile | |
| - name: Typecheck extension | |
| run: | | |
| cd app/extension | |
| yarn typecheck | |
| - name: Create extension package (Chrome) | |
| run: | | |
| cd app/extension | |
| yarn zip | |
| env: | |
| CI: false | |
| EXTENSION_VERSION: ${{ needs.create-release.outputs.version }} | |
| - name: Verify extension package | |
| run: | | |
| python3 - <<'PY' | |
| import json | |
| import os | |
| import zipfile | |
| version = os.environ["EXTENSION_VERSION"] | |
| manifest_path = "app/extension/dist/manifest.json" | |
| zip_path = f"app/extension/dist/huntly-{version}-chrome.zip" | |
| with open(manifest_path, encoding="utf-8") as manifest_file: | |
| manifest = json.load(manifest_file) | |
| if manifest.get("version") != version: | |
| raise SystemExit( | |
| f"Manifest version {manifest.get('version')} does not match tag version {version}" | |
| ) | |
| with zipfile.ZipFile(zip_path) as archive: | |
| names = set(archive.namelist()) | |
| if "manifest.json" not in names: | |
| raise SystemExit("Extension zip must contain manifest.json at the archive root") | |
| PY | |
| env: | |
| EXTENSION_VERSION: ${{ needs.create-release.outputs.version }} | |
| - name: Package release files | |
| run: | | |
| mkdir -p release | |
| cp app/extension/dist/huntly-${{ needs.create-release.outputs.version }}-chrome.zip \ | |
| release/huntly-chrome-extension-${{ needs.create-release.outputs.version }}.zip | |
| - name: Upload Chrome extension to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.create-release.outputs.release_upload_url }} | |
| asset_path: release/huntly-chrome-extension-${{ needs.create-release.outputs.version }}.zip | |
| asset_name: huntly-chrome-extension-${{ needs.create-release.outputs.version }}.zip | |
| asset_content_type: application/zip | |