-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: update | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
type: string | ||
version: | ||
type: string | ||
assets: | ||
type: string | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 7 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Copy public | ||
run: cp -r ./public ./temp | ||
- name: Genetare update files | ||
env: | ||
NAME: ${{ inputs.name }} | ||
VERSION: ${{ inputs.version }} | ||
ASSETS: ${{ inputs.assets }} | ||
run: node ./scripts/update.mjs | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: temp | ||
clean: false |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { writeFile } from 'fs/promises'; | ||
import { join, dirname } from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
async function main() { | ||
const name = process.env.NAME; | ||
const version = process.env.VERSION; | ||
const assets = JSON.parse(process.env.ASSETS); | ||
|
||
const outputFloder = [ | ||
join(__dirname, '../temp', name), | ||
]; | ||
|
||
// Header Editor has multi output floders | ||
if (name === 'header-editor') { | ||
outputFloder.push(join(__dirname, '../temp/headereditor')); | ||
} | ||
|
||
for (const item of assets) { | ||
if (!item.name.endsWith('.xpi') || !item.name.endsWith('.crx')) { | ||
continue; | ||
} | ||
|
||
if (item.name.endsWith('.xpi')) { | ||
// firefox | ||
const content = JSON.stringify({ | ||
addons: { | ||
[item.id]: { | ||
updates: [{ | ||
version: version, | ||
update_link: item.url, | ||
update_hash: `sha256:${item.hash}`, | ||
}] | ||
} | ||
} | ||
}); | ||
|
||
for (const floder of outputFloder) { | ||
console.log('write update.json to ' + floder); | ||
await writeFile(join(floder, 'update.json'), content, 'utf-8'); | ||
} | ||
} | ||
|
||
if (item.name.endsWith('.crx')) { | ||
// chrome | ||
const content = `<?xml version='1.0' encoding='UTF-8'?><gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'><app appid='${item.id}'><updatecheck codebase='${item.url}' version='${version}' prodversionmin='64.0.3242' /></app></gupdate>`; | ||
|
||
for (const floder of outputFloder) { | ||
console.log('write update.xml to ' + floder); | ||
await writeFile(join(floder, 'update.xml'), content, 'utf-8'); | ||
if (name === 'xstyle') { | ||
// xStyle has multi xml | ||
await writeFile(join(floder, 'updates.xml'), content, 'utf-8'); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
main(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.