-
Notifications
You must be signed in to change notification settings - Fork 3
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
8 changed files
with
94 additions
and
34 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
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
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
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,43 @@ | ||
import { getArtifactDownloadUrl } from './lib/sitmc.js' | ||
import esMain from 'es-main' | ||
import { uploadPreviewVersion } from "./lib/backend.js" | ||
import { getLatestTag } from "./lib/git.js" | ||
import { cli } from "@liplum/cli" | ||
|
||
const main = async () => { | ||
const args = cli({ | ||
name: 'publish-preview', | ||
description: 'Publish the preview and version info onto the back end.', | ||
examples: ['node ./publish-preview.js',], | ||
require: [], | ||
options: [], | ||
}) | ||
const { version } = await getLatestTag() | ||
const info = buildVersionInfo({ | ||
version, | ||
}) | ||
|
||
const result = await uploadPreviewVersion(info) | ||
console.log(`Uploaded result: ${result}`) | ||
} | ||
|
||
const buildVersionInfo = ({ version }) => { | ||
const fileName = `sitlife-v${version}.apk` | ||
const info = { | ||
version, | ||
releaseNote: { | ||
"zh-Hans": "", | ||
}, | ||
assets: { | ||
Android: { | ||
fileName, | ||
defaultSrc: getArtifactDownloadUrl({ tagName: "mimir-preview", fileName }), | ||
} | ||
}, | ||
} | ||
return info | ||
} | ||
|
||
if (esMain(import.meta)) { | ||
main() | ||
} |
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
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,34 @@ | ||
import { uploadFile } from "./lib/sitmc.js" | ||
import { cli } from '@liplum/cli' | ||
import esMain from "es-main" | ||
import { sanitizeNameForUri } from "./lib/utils.js" | ||
import { getLatestTag } from "./lib/git.js" | ||
import "dotenv/config" | ||
|
||
const main = async () => { | ||
const args = cli({ | ||
name: 'upload-preview-sitmc', | ||
description: 'Upload preview files onto SIT-MC server. Env $SITMC_FILE_TOKEN required.', | ||
examples: ['node ./upload-preview-sitmc.js -s <file>',], | ||
require: ['source'], | ||
options: [{ | ||
name: 'source', | ||
alias: "s", | ||
defaultOption: true, | ||
description: 'The path of local file to upload to SIT-MC server.' | ||
}], | ||
}) | ||
|
||
const version = await getLatestTag() | ||
const filePath = args.source | ||
const res = await uploadFile({ | ||
localFilePath: filePath, | ||
remotePath: `mimir-preview/${sanitizeNameForUri(`sitlife-v${version}.apk`)}`, | ||
}) | ||
console.log(res) | ||
} | ||
|
||
|
||
if (esMain(import.meta)) { | ||
main() | ||
} |
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
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