mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-04-24 19:48:37 +09:00
Publish extension packages to releases
Rewrite package-extensions workflow to publish built extension artifacts directly to GitHub Releases instead of uploading Actions artifacts. Changes include: enable Node 24 for JS actions, add workflow_dispatch input (release_tag), resolve release tag at runtime, upgrade actions/checkout to v5 and set contents permission to write, produce dist/release/*.zip/.xpi, remove artifact uploads, create/reuse release and upload assets with gh, and write a workflow summary. README updated to document the new release-based publishing flow and Node/checkout changes.
This commit is contained in:
@@ -1,7 +1,14 @@
|
|||||||
name: Package Extensions
|
name: Package Extensions
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
release_tag:
|
||||||
|
description: Release tag used for direct asset upload, for example v2026.04.23
|
||||||
|
required: true
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
@@ -10,10 +17,20 @@ jobs:
|
|||||||
package:
|
package:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Resolve release tag
|
||||||
|
id: release
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
tag='${{ github.event.inputs.release_tag }}'
|
||||||
|
else
|
||||||
|
tag='${{ github.ref_name }}'
|
||||||
|
fi
|
||||||
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Read extension versions
|
- name: Read extension versions
|
||||||
id: versions
|
id: versions
|
||||||
@@ -35,28 +52,28 @@ jobs:
|
|||||||
|
|
||||||
- name: Build package files
|
- name: Build package files
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist/store dist/offline
|
mkdir -p dist/release
|
||||||
|
|
||||||
pushd chrome >/dev/null
|
pushd chrome >/dev/null
|
||||||
zip -qr "../dist/store/memos-bber-chrome-webstore-${{ steps.versions.outputs.chrome_version }}.zip" .
|
zip -qr "../dist/release/memos-bber-chrome-${{ steps.versions.outputs.chrome_version }}.zip" .
|
||||||
zip -qr "../dist/offline/memos-bber-chrome-offline-${{ steps.versions.outputs.chrome_version }}.zip" .
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
pushd firefox >/dev/null
|
pushd firefox >/dev/null
|
||||||
zip -qr "../dist/store/memos-bber-firefox-amo-${{ steps.versions.outputs.firefox_version }}.xpi" .
|
zip -qr "../dist/release/memos-bber-firefox-${{ steps.versions.outputs.firefox_version }}.xpi" .
|
||||||
zip -qr "../dist/offline/memos-bber-firefox-offline-${{ steps.versions.outputs.firefox_version }}.xpi" .
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
- name: Upload store packages
|
- name: Publish release assets
|
||||||
uses: actions/upload-artifact@v4
|
env:
|
||||||
with:
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
name: store-packages
|
run: |
|
||||||
path: dist/store/*
|
tag='${{ steps.release.outputs.tag }}'
|
||||||
if-no-files-found: error
|
gh release view "$tag" >/dev/null 2>&1 || \
|
||||||
|
gh release create "$tag" --title "$tag" --notes "Automated extension packages"
|
||||||
|
gh release upload "$tag" dist/release/* --clobber
|
||||||
|
|
||||||
- name: Upload offline packages
|
- name: Write workflow summary
|
||||||
uses: actions/upload-artifact@v4
|
run: |
|
||||||
with:
|
tag='${{ steps.release.outputs.tag }}'
|
||||||
name: offline-packages
|
echo "## Release assets" >> "$GITHUB_STEP_SUMMARY"
|
||||||
path: dist/offline/*
|
echo "- Chrome: https://github.com/${{ github.repository }}/releases/download/$tag/memos-bber-chrome-${{ steps.versions.outputs.chrome_version }}.zip" >> "$GITHUB_STEP_SUMMARY"
|
||||||
if-no-files-found: error
|
echo "- Firefox: https://github.com/${{ github.repository }}/releases/download/$tag/memos-bber-firefox-${{ steps.versions.outputs.firefox_version }}.xpi" >> "$GITHUB_STEP_SUMMARY"
|
||||||
@@ -8,12 +8,14 @@
|
|||||||
|
|
||||||
## 打包
|
## 打包
|
||||||
|
|
||||||
仓库内置了 GitHub Actions 工作流 [package-extensions.yml](.github/workflows/package-extensions.yml),支持手动触发或在推送 `v*` 标签时自动打包。
|
仓库内置了 GitHub Actions 工作流 [package-extensions.yml](.github/workflows/package-extensions.yml),支持手动触发或在推送 `v*` 标签时自动打包并发布到 GitHub Releases。
|
||||||
|
|
||||||
- `store-packages`:商店上传用文件,包含 Chrome 的 zip 包和 Firefox 的 xpi 包。
|
- 推送 `v*` 标签时:自动把 Chrome 的 zip 包和 Firefox 的 xpi 包上传为对应 Release 的 assets。
|
||||||
- `offline-packages`:离线分发用文件,包含 Chrome 的 zip 包和 Firefox 的 xpi 包。
|
- 手动触发时:需要填写 `release_tag`,工作流会把产物直接上传到这个 tag 对应的 Release。
|
||||||
|
- 下载时拿到的是文件本体,不再通过 Actions artifact 额外包一层 zip。
|
||||||
|
- 打包源码固定来自 `main` 分支;`tag` 只用于决定上传到哪个 Release。
|
||||||
|
|
||||||
说明:Chrome 的离线包用于解压后在开发者模式中“加载已解压的扩展程序”;Firefox 的离线包为未签名 xpi,适合临时附加组件或自行签名后的分发场景。
|
说明:Chrome 的 zip 包可用于商店上传,Firefox 的 xpi 包可用于 AMO 上传或离线分发。工作流已显式启用 Node 24 运行 JavaScript actions,并使用新的 `actions/checkout@v5`。
|
||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
- 20260422 调整发送设置,支持仅发送附件
|
- 20260422 调整发送设置,支持仅发送附件
|
||||||
|
|||||||
Reference in New Issue
Block a user