Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Clash Verge
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Clash Verge
Commits
aaa4fbcd
There was an error fetching the commit references. Please try again later.
Unverified
Commit
aaa4fbcd
authored
2 years ago
by
GyDi
Browse files
Options
Downloads
Patches
Plain Diff
chore: aarch upload script
parent
150f0cf4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
package.json
+1
-0
1 addition, 0 deletions
package.json
scripts/aarch.mjs
+104
-0
104 additions, 0 deletions
scripts/aarch.mjs
with
106 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
aaa4fbcd
...
...
@@ -4,3 +4,4 @@ dist
dist-ssr
*.local
update.json
scripts/_env.sh
This diff is collapsed.
Click to expand it.
package.json
+
1
−
0
View file @
aaa4fbcd
...
...
@@ -10,6 +10,7 @@
"web:dev"
:
"vite"
,
"web:build"
:
"tsc && vite build"
,
"web:serve"
:
"vite preview"
,
"aarch"
:
"node scripts/aarch.mjs"
,
"check"
:
"node scripts/check.mjs"
,
"updater"
:
"node scripts/updater.mjs"
,
"publish"
:
"node scripts/publish.mjs"
,
...
...
This diff is collapsed.
Click to expand it.
scripts/aarch.mjs
0 → 100644
+
104
−
0
View file @
aaa4fbcd
/**
* Build and upload assets for macOS(aarch)
*/
import
fs
from
"
fs-extra
"
;
import
path
from
"
path
"
;
import
{
exit
}
from
"
process
"
;
import
{
createRequire
}
from
"
module
"
;
import
{
getOctokit
,
context
}
from
"
@actions/github
"
;
const
require
=
createRequire
(
import
.
meta
.
url
);
async
function
resolve
()
{
if
(
!
process
.
env
.
GITHUB_TOKEN
)
{
throw
new
Error
(
"
GITHUB_TOKEN is required
"
);
}
if
(
!
process
.
env
.
GITHUB_REPOSITORY
)
{
throw
new
Error
(
"
GITHUB_REPOSITORY is required
"
);
}
if
(
!
process
.
env
.
TAURI_PRIVATE_KEY
)
{
throw
new
Error
(
"
TAURI_PRIVATE_KEY is required
"
);
}
if
(
!
process
.
env
.
TAURI_KEY_PASSWORD
)
{
throw
new
Error
(
"
TAURI_KEY_PASSWORD is required
"
);
}
const
{
version
}
=
require
(
"
../package.json
"
);
const
cwd
=
process
.
cwd
();
const
bundlePath
=
path
.
join
(
cwd
,
"
src-tauri/target/release/bundle
"
);
const
join
=
(
p
)
=>
path
.
join
(
bundlePath
,
p
);
const
appPathList
=
[
join
(
"
macos/Clash Verge.aarch64.app.tar.gz
"
),
join
(
"
macos/Clash Verge.aarch64.app.tar.gz.sig
"
),
];
for
(
const
appPath
of
appPathList
)
{
if
(
fs
.
pathExistsSync
(
appPath
))
{
fs
.
removeSync
(
appPath
);
}
}
fs
.
copyFileSync
(
join
(
"
macos/Clash Verge.app.tar.gz
"
),
appPathList
[
0
]);
fs
.
copyFileSync
(
join
(
"
macos/Clash Verge.app.tar.gz.sig
"
),
appPathList
[
1
]);
const
options
=
{
owner
:
context
.
repo
.
owner
,
repo
:
context
.
repo
.
repo
};
const
github
=
getOctokit
(
process
.
env
.
GITHUB_TOKEN
);
const
{
data
:
release
}
=
await
github
.
rest
.
repos
.
getReleaseByTag
({
...
options
,
tag
:
`v
${
version
}
`
,
});
if
(
!
release
.
id
)
throw
new
Error
(
"
failed to find the release
"
);
await
uploadAssets
(
release
.
id
,
[
join
(
`dmg/Clash Verge_
${
version
}
_aarch64.dmg`
),
...
appPathList
,
]);
}
// From tauri-apps/tauri-action
// https://github.com/tauri-apps/tauri-action/blob/dev/packages/action/src/upload-release-assets.ts
async
function
uploadAssets
(
releaseId
,
assets
)
{
const
github
=
getOctokit
(
process
.
env
.
GITHUB_TOKEN
);
// Determine content-length for header to upload asset
const
contentLength
=
(
filePath
)
=>
fs
.
statSync
(
filePath
).
size
;
for
(
const
assetPath
of
assets
)
{
const
headers
=
{
"
content-type
"
:
"
application/zip
"
,
"
content-length
"
:
contentLength
(
assetPath
),
};
const
ext
=
path
.
extname
(
assetPath
);
const
filename
=
path
.
basename
(
assetPath
).
replace
(
ext
,
""
);
const
assetName
=
path
.
dirname
(
assetPath
).
includes
(
`target
${
path
.
sep
}
debug`
)
?
`
${
filename
}
-debug
${
ext
}
`
:
`
${
filename
}${
ext
}
`
;
console
.
log
(
`[INFO]: Uploading
${
assetName
}
...`
);
try
{
await
github
.
rest
.
repos
.
uploadReleaseAsset
({
headers
,
name
:
assetName
,
data
:
fs
.
readFileSync
(
assetPath
),
owner
:
context
.
repo
.
owner
,
repo
:
context
.
repo
.
repo
,
release_id
:
releaseId
,
});
}
catch
(
error
)
{
console
.
log
(
error
.
message
);
}
}
}
if
(
process
.
platform
===
"
darwin
"
&&
process
.
arch
===
"
arm64
"
)
{
resolve
();
}
else
{
console
.
error
(
"
invalid
"
);
exit
(
1
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment