mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-15 19:22:31 +08:00
fix artifact
This commit is contained in:
parent
30bf7567fb
commit
7df1894af3
136
.github/workflows/build.yml
vendored
136
.github/workflows/build.yml
vendored
|
@ -272,10 +272,12 @@ jobs:
|
|||
body_path: changelog.md
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
artifact:
|
||||
artifact-windows:
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
needs: [windows, macos, linux, windows7, macos10]
|
||||
needs: windows
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: artifact
|
||||
services:
|
||||
telegram-bot-api:
|
||||
image: aiogram/telegram-bot-api:latest
|
||||
|
@ -294,10 +296,140 @@ jobs:
|
|||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: 'Windows*'
|
||||
merge-multiple: true
|
||||
- name: Upload Artifacts
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
ARTIFACT_TARGET: windows
|
||||
run: pnpm artifact
|
||||
|
||||
artifact-windows7:
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
needs: windows7
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: artifact
|
||||
services:
|
||||
telegram-bot-api:
|
||||
image: aiogram/telegram-bot-api:latest
|
||||
env:
|
||||
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_BOT_API_ID }}
|
||||
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_BOT_API_HASH }}
|
||||
ports:
|
||||
- 8081:8081
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
run: npm install -g pnpm
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: 'Win7*'
|
||||
merge-multiple: true
|
||||
- name: Upload Artifacts
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
ARTIFACT_TARGET: windows7
|
||||
run: pnpm artifact
|
||||
|
||||
artifact-macos:
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
needs: macos
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: artifact
|
||||
services:
|
||||
telegram-bot-api:
|
||||
image: aiogram/telegram-bot-api:latest
|
||||
env:
|
||||
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_BOT_API_ID }}
|
||||
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_BOT_API_HASH }}
|
||||
ports:
|
||||
- 8081:8081
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
run: npm install -g pnpm
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: 'MacOS*'
|
||||
merge-multiple: true
|
||||
- name: Upload Artifacts
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
ARTIFACT_TARGET: macos
|
||||
run: pnpm artifact
|
||||
|
||||
artifact-macos10:
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
needs: macos10
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: artifact
|
||||
services:
|
||||
telegram-bot-api:
|
||||
image: aiogram/telegram-bot-api:latest
|
||||
env:
|
||||
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_BOT_API_ID }}
|
||||
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_BOT_API_HASH }}
|
||||
ports:
|
||||
- 8081:8081
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
run: npm install -g pnpm
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: 'Catalina*'
|
||||
merge-multiple: true
|
||||
- name: Upload Artifacts
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
ARTIFACT_TARGET: macos10
|
||||
run: pnpm artifact
|
||||
|
||||
artifact-linux:
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
needs: linux
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: artifact
|
||||
services:
|
||||
telegram-bot-api:
|
||||
image: aiogram/telegram-bot-api:latest
|
||||
env:
|
||||
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_BOT_API_ID }}
|
||||
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_BOT_API_HASH }}
|
||||
ports:
|
||||
- 8081:8081
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
run: npm install -g pnpm
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: 'Linux*'
|
||||
merge-multiple: true
|
||||
- name: Upload Artifacts
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
ARTIFACT_TARGET: linux
|
||||
run: pnpm artifact
|
||||
|
||||
updater:
|
||||
|
|
|
@ -7,28 +7,14 @@ import { execSync } from 'child_process'
|
|||
|
||||
const CHAT_ID = '@MihomoPartyCi'
|
||||
const GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE
|
||||
const ARTIFACT_TARGET = process.env.ARTIFACT_TARGET
|
||||
const pkg = fs.readFileSync('package.json', 'utf-8')
|
||||
const { version } = JSON.parse(pkg)
|
||||
const hash = execSync('git rev-parse --short HEAD').toString().trim()
|
||||
const message = execSync('git log -1 --pretty=%B').toString().trim()
|
||||
|
||||
const linuxFiles = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-aarch64.rpm`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-arm64.deb`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-x86_64.rpm`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-amd64.deb`)
|
||||
]
|
||||
|
||||
const macosFiles = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-macos-${version}-arm64.pkg`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-macos-${version}-x64.pkg`)
|
||||
]
|
||||
|
||||
const macos10Files = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-catalina-${version}-arm64.pkg`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-catalina-${version}-x64.pkg`)
|
||||
]
|
||||
|
||||
switch (ARTIFACT_TARGET) {
|
||||
case 'windows': {
|
||||
const windowsFiles = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-windows-${version}-x64-setup.exe`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-windows-${version}-x64-portable.7z`),
|
||||
|
@ -37,14 +23,6 @@ const windowsFiles = [
|
|||
path.join(GITHUB_WORKSPACE, `mihomo-party-windows-${version}-arm64-setup.exe`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-windows-${version}-arm64-portable.7z`)
|
||||
]
|
||||
|
||||
const windows7Files = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-x64-setup.exe`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-x64-portable.7z`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-ia32-setup.exe`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-ia32-portable.7z`)
|
||||
]
|
||||
|
||||
const windowsMedia = windowsFiles.map((file, index) => ({
|
||||
type: 'document',
|
||||
media: `attach://file${index}`
|
||||
|
@ -56,7 +34,22 @@ windowsForm.append('media', JSON.stringify(windowsMedia))
|
|||
windowsFiles.forEach((file, index) => {
|
||||
windowsForm.append(`file${index}`, fs.createReadStream(file))
|
||||
})
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
windowsForm,
|
||||
{
|
||||
headers: windowsForm.getHeaders()
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'windows7': {
|
||||
const windows7Files = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-x64-setup.exe`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-x64-portable.7z`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-ia32-setup.exe`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-win7-${version}-ia32-portable.7z`)
|
||||
]
|
||||
const windows7Media = windows7Files.map((file, index) => ({
|
||||
type: 'document',
|
||||
media: `attach://file${index}`
|
||||
|
@ -68,19 +61,20 @@ windows7Form.append('media', JSON.stringify(windows7Media))
|
|||
windows7Files.forEach((file, index) => {
|
||||
windows7Form.append(`file${index}`, fs.createReadStream(file))
|
||||
})
|
||||
|
||||
const linuxMedia = linuxFiles.map((file, index) => ({
|
||||
type: 'document',
|
||||
media: `attach://file${index}`
|
||||
}))
|
||||
linuxMedia[linuxMedia.length - 1].caption = `#${hash} #Linux\n${message}`
|
||||
const linuxForm = new FormData()
|
||||
linuxForm.append('chat_id', CHAT_ID)
|
||||
linuxForm.append('media', JSON.stringify(linuxMedia))
|
||||
linuxFiles.forEach((file, index) => {
|
||||
linuxForm.append(`file${index}`, fs.createReadStream(file))
|
||||
})
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
windows7Form,
|
||||
{
|
||||
headers: windows7Form.getHeaders()
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'macos': {
|
||||
const macosFiles = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-macos-${version}-arm64.pkg`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-macos-${version}-x64.pkg`)
|
||||
]
|
||||
const macosMedia = macosFiles.map((file, index) => ({
|
||||
type: 'document',
|
||||
media: `attach://file${index}`
|
||||
|
@ -92,7 +86,20 @@ macosForm.append('media', JSON.stringify(macosMedia))
|
|||
macosFiles.forEach((file, index) => {
|
||||
macosForm.append(`file${index}`, fs.createReadStream(file))
|
||||
})
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
macosForm,
|
||||
{
|
||||
headers: macosForm.getHeaders()
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'macos10': {
|
||||
const macos10Files = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-catalina-${version}-arm64.pkg`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-catalina-${version}-x64.pkg`)
|
||||
]
|
||||
const macos10Media = macos10Files.map((file, index) => ({
|
||||
type: 'document',
|
||||
media: `attach://file${index}`
|
||||
|
@ -104,41 +111,6 @@ macos10Form.append('media', JSON.stringify(macos10Media))
|
|||
macos10Files.forEach((file, index) => {
|
||||
macos10Form.append(`file${index}`, fs.createReadStream(file))
|
||||
})
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
windowsForm,
|
||||
{
|
||||
headers: windowsForm.getHeaders()
|
||||
}
|
||||
)
|
||||
|
||||
await sleep(10000)
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
windows7Form,
|
||||
{
|
||||
headers: windows7Form.getHeaders()
|
||||
}
|
||||
)
|
||||
|
||||
await sleep(10000)
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
macosForm,
|
||||
{
|
||||
headers: macosForm.getHeaders()
|
||||
}
|
||||
)
|
||||
|
||||
await sleep(10000)
|
||||
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
macos10Form,
|
||||
|
@ -146,9 +118,26 @@ await axios.post(
|
|||
headers: macos10Form.getHeaders()
|
||||
}
|
||||
)
|
||||
|
||||
await sleep(10000)
|
||||
|
||||
break
|
||||
}
|
||||
case 'linux': {
|
||||
const linuxFiles = [
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-aarch64.rpm`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-arm64.deb`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-x86_64.rpm`),
|
||||
path.join(GITHUB_WORKSPACE, `mihomo-party-linux-${version}-amd64.deb`)
|
||||
]
|
||||
const linuxMedia = linuxFiles.map((file, index) => ({
|
||||
type: 'document',
|
||||
media: `attach://file${index}`
|
||||
}))
|
||||
linuxMedia[linuxMedia.length - 1].caption = `#${hash} #Linux\n${message}`
|
||||
const linuxForm = new FormData()
|
||||
linuxForm.append('chat_id', CHAT_ID)
|
||||
linuxForm.append('media', JSON.stringify(linuxMedia))
|
||||
linuxFiles.forEach((file, index) => {
|
||||
linuxForm.append(`file${index}`, fs.createReadStream(file))
|
||||
})
|
||||
await axios.post(
|
||||
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
|
||||
linuxForm,
|
||||
|
@ -156,3 +145,6 @@ await axios.post(
|
|||
headers: linuxForm.getHeaders()
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user