1+ name : Update
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ trigger_docs_update :
7+ description : ' Trigger docs update'
8+ required : false
9+ default : false
10+ type : boolean
11+ release_update :
12+ description : ' Release update files'
13+ required : false
14+ default : false
15+ type : boolean
16+ version :
17+ description : ' Version tag (for release update)'
18+ required : false
19+ type : string
20+
21+ permissions : write-all
22+
23+ env :
24+ VITE_UMAMI_SCRIPT_URL : ${{ secrets.VITE_UMAMI_SCRIPT_URL }}
25+ VITE_UMAMI_DATA_WEBSITE_ID : ${{ secrets.VITE_UMAMI_DATA_WEBSITE_ID }}
26+ VITE_BASE_URL : ${{ secrets.VITE_BASE_URL }}
27+ VITE_API_BASE_URL : ${{ secrets.VITE_API_BASE_URL }}
28+
29+ jobs :
30+ trigger-docs-update :
31+ runs-on : ubuntu-latest
32+ if : github.event.inputs.trigger_docs_update == 'true'
33+ steps :
34+ - name : Trigger update
35+ run : |
36+ curl -X POST https://api.github.com/repos/allentown521/saladict-desktop-docs/dispatches \
37+ -H "Accept: application/vnd.github.everest-preview+json" \
38+ -H "Authorization: token ${{ secrets.TOKEN }}" \
39+ -d '{"event_type": "plugins-updated"}'
40+
41+ release-update :
42+ runs-on : ubuntu-latest
43+ if : github.event.inputs.release_update == 'true'
44+ steps :
45+ - name : Checkout repository
46+ uses : actions/checkout@v4
47+ with :
48+ fetch-depth : 0
49+ - name : Install git
50+ run : |
51+ sudo apt-get update
52+ sudo apt-get install -y git curl
53+ - name : Get Tag Name
54+ run : |
55+ if [ -n "${{ github.event.inputs.version }}" ]; then
56+ echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
57+ echo "VERSION=${{ github.event.inputs.version }}"
58+ else
59+ echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')" >> $GITHUB_ENV
60+ echo "VERSION=$(git describe --tags | sed 's/-[0-9]*-.*//g')"
61+ fi
62+ - name : Setup pnpm
63+ uses : pnpm/action-setup@v4
64+ with :
65+ version : 9
66+ - name : pnpm install
67+ run : pnpm install
68+ - name : Release updater file
69+ run : |
70+ pnpm run updater
71+ pnpm run updater:fixRuntime
72+ env :
73+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
74+ - name : Upload Release
75+ uses : softprops/action-gh-release@v1
76+ with :
77+ body : ${{env.VERSION}}
78+ tag_name : updater
79+ token : ${{ secrets.GITHUB_TOKEN }}
80+ files : |
81+ update.json
82+ update-fix-runtime.json
0 commit comments