add workflow

This commit is contained in:
Gabe Yuan
2023-08-14 16:39:03 +08:00
parent bcb9974253
commit 97f775e1a5
5 changed files with 70 additions and 13 deletions

4
.env
View File

@@ -7,6 +7,6 @@ REACT_APP_HOMEPAGE=https://github.com/fishjar/kiss-translator
REACT_APP_OPTIONSPAGE=https://kiss-translator.rayjar.com/options
REACT_APP_OPTIONSPAGE2=https://fishjar.github.io/kiss-translator/options.html
REACT_APP_OPTIONSPAGE_DEV=http://localhost:3000/options.html
REACT_APP_LOGOURL=https://raw.githubusercontent.com/fishjar/kiss-translator/master/public/images/logo192.png
REACT_APP_LOGOURL=https://kiss-translator.rayjar.com/images/logo192.png
REACT_APP_USERSCRIPT_DOWNLOADURL=https://kiss-translator.rayjar.com/kiss-translator.user.js
REACT_APP_USERSCRIPT_DOWNLOADURL2=https://raw.githubusercontent.com/fishjar/kiss-translator/master/dist/userscript/kiss-translator.user.js
REACT_APP_USERSCRIPT_DOWNLOADURL2=https://fishjar.github.io/kiss-translator/kiss-translator.user.js

57
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: publish release version
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
setps:
- name: Build all
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.9.0"
registry-url: "https://registry.npmjs.org"
- run: yarn install
- run: yarn build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/web
branch: gh-pages
archive:
needs: build
runs-on: ubuntu-latest
steps:
- id: release
run: echo "fileName=kiss-translator_${{ github.ref }}.zip" >> "$GITHUB_OUTPUT"
- name: Archive Release
id: archive_release
run: zip -r ${{ steps.release.fileName }} build
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.release.fileName }}
asset_name: ${{ steps.release.fileName }}
asset_content_type: application/zip

View File

@@ -40,7 +40,7 @@ If you also like a little more simplicity, welcome to pick it up.
- [x] [Greasy Fork](https://greasyfork.org/zh-CN/scripts/472840-kiss-translator)
- [x] Open source
- [x] Data Synchronization Function
- [x] Greasemonkey Script ([Install Link 1](https://github.com/fishjar/kiss-translator/raw/master/dist/userscript/kiss-translator.user.js) , [Install Link 1](https://kiss-translator.rayjar.com/kiss-translator.user.js))
- [x] Greasemonkey Script
- [x] [Tampermonkey](https://www.tampermonkey.net/) (Chrome/Edge/Firefox)
- [ ] [Userscripts Safari](https://github.com/quoid/userscripts) (need test)
@@ -49,8 +49,8 @@ If you also like a little more simplicity, welcome to pick it up.
```sh
git clone https://github.com/fishjar/kiss-translator.git
cd kiss-translator
yarn
yarn dist
yarn install
yarn build
```
### Data Sync

View File

@@ -40,7 +40,7 @@
- [x] [Greasy Fork](https://greasyfork.org/zh-CN/scripts/472840-kiss-translator)
- [x] 开放源代码
- [x] 数据同步功能
- [x] 油猴脚本 ([安装链接 1](https://github.com/fishjar/kiss-translator/raw/master/dist/userscript/kiss-translator.user.js) , [安装链接 2](https://kiss-translator.rayjar.com/kiss-translator.user.js))
- [x] 油猴脚本
- [x] [Tampermonkey](https://www.tampermonkey.net/) (Chrome/Edge/Firefox)
- [ ] [Userscripts Safari](https://github.com/quoid/userscripts) (待测)
@@ -49,8 +49,8 @@
```sh
git clone https://github.com/fishjar/kiss-translator.git
cd kiss-translator
yarn
yarn dist
yarn install
yarn build
```
### 数据同步

View File

@@ -20,13 +20,13 @@
"scripts": {
"start": "REACT_APP_CLIENT=web react-app-rewired start",
"start:userscript": "REACT_APP_CLIENT=userscript react-app-rewired start",
"build": "rm -rf build/chrome && BUILD_PATH=./build/chrome REACT_APP_CLIENT=chrome react-app-rewired build",
"build:chrome": "rm -rf build/chrome && BUILD_PATH=./build/chrome REACT_APP_CLIENT=chrome react-app-rewired build",
"build:edge": "rm -rf build/edge && cp -r build/chrome build/edge",
"build:firefox": "rm -rf build/firefox && cp -r build/chrome build/firefox && cat ./build/firefox/manifest.firefox.json > ./build/firefox/manifest.json",
"build:userscript": "BUILD_PATH=./build/userscript REACT_APP_CLIENT=userscript react-app-rewired build",
"build:all": "yarn build && yarn build:edge && yarn build:firefox && yarn build:userscript",
"dist": "yarn build:all && rm -rf dist && rm -rf docs && cp -r build dist && mv dist/userscript docs && mkdir dist/userscript && cp docs/kiss-translator.user.js dist/userscript/kiss-translator.user.js",
"deploy:web": "wrangler pages deploy ./docs --project-name kiss-translator",
"build:web": "rm -rf build/web && BUILD_PATH=./build/web REACT_APP_CLIENT=userscript react-app-rewired build",
"build:userscript": "rm -rf build/userscript && mkdir build/userscript && cp build/web/kiss-translator.user.js build/userscript/kiss-translator.user.js",
"build": "yarn build:chrome && yarn build:edge && yarn build:firefox && yarn build:web && yarn build:userscript",
"deploy:web": "wrangler pages deploy ./build/web --project-name kiss-translator",
"zip": "zip -r edge.zip dist/edge/",
"test": "react-app-rewired test",
"eject": "react-scripts eject"