docs: edit README.md #302
This file contains 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: Check and Create Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
check-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22' | |
- name: Install dependencies | |
run: npm install | |
- name: Get package.json version | |
id: get_version | |
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Get latest release version | |
id: get_release | |
run: | | |
curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name' > latest_release.txt | |
- name: Compare versions | |
id: compare_versions | |
run: | | |
if [ "$(cat latest_release.txt)" != "$PACKAGE_VERSION" ]; then | |
echo "Version mismatch" | |
echo "create_release=true" >> $GITHUB_ENV | |
else | |
echo "Version matches" | |
echo "create_release=false" >> $GITHUB_ENV | |
fi | |
- name: Create new release | |
if: env.create_release == 'true' | |
run: | | |
CURRENT_DATE=$(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M') | |
sed -i "s/\$PACKAGE_VERSION/$PACKAGE_VERSION/g" CHANGELOG.md | |
sed -i "s/\$CURRENT_DATE/$CURRENT_DATE/g" CHANGELOG.md | |
gh release create "$PACKAGE_VERSION" .output/chrome-mv3.zip \ | |
-t "$PACKAGE_VERSION" \ | |
-n "$(cat CHANGELOG.md) | |
--- | |
使用方法,下载下方的 chrome-mv3.zip,然后打开 chrome://extensions/,勾选开发者模式,将下载的 zip 包拖拽进去即可。 | |
[查看 $PACKAGE_VERSION 更新日志](https://github.com/dlzmoe/linuxdo-scripts/blob/main/version-log.md) | |
发布于:$CURRENT_DATE" | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |