mirror of
https://github.com/PaiGramTeam/GetToken.git
synced 2024-11-21 22:48:07 +00:00
auto update
This commit is contained in:
parent
881a1d9eb6
commit
29bee51ab6
13
.github/update.js
vendored
Normal file
13
.github/update.js
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const utils = require("./utils");
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const latestVersionInfo = await utils.getAppVersion()
|
||||||
|
let releaseInfo = await utils.getLatestRelease()
|
||||||
|
if (releaseInfo.name !== latestVersionInfo["package_version"]) {
|
||||||
|
await utils.runWorkflow(41172724)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})()
|
12
.github/utils.js
vendored
12
.github/utils.js
vendored
@ -50,4 +50,14 @@ const uploadReleaseAsset = async (url, path) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { getAppVersion, getLatestRelease, createRelease, uploadReleaseAsset }
|
const runWorkflow = async id => {
|
||||||
|
return await axios.post(`https://api.github.com/repos/${repo}/actions/workflows/${id}/dispatches`, {
|
||||||
|
ref: "master"
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
"Authorization": `Bearer ${token}`,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { getAppVersion, getLatestRelease, createRelease, uploadReleaseAsset, runWorkflow }
|
||||||
|
25
.github/workflows/update.yml
vendored
Normal file
25
.github/workflows/update.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: Update Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 12 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GHP_TOKEN: ${{ secrets.GHP_TOKEN }}
|
||||||
|
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
||||||
|
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Node 16
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- name: Install depencies
|
||||||
|
run: npm install axios@0.27.2
|
||||||
|
- name: Run script
|
||||||
|
run: node .github/update.js
|
Loading…
Reference in New Issue
Block a user