-
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.
fixes for windows paths and binary names
- Loading branch information
Adam McKee
committed
Dec 21, 2024
1 parent
5b5368a
commit ce6b4c6
Showing
10 changed files
with
160 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Upload Windows | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release_id: | ||
required: true | ||
type: string | ||
tag_name: | ||
required: true | ||
type: string | ||
upload_hostname: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
|
||
publish-asset: | ||
runs-on: windows-2022 | ||
strategy: | ||
matrix: | ||
include: | ||
- filename: l3-windows-aarch64.exe | ||
target: aarch64-pc-windows-msvc | ||
- filename: l3-windows-x86_64.exe | ||
target: x86_64-pc-windows-msvc | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag_name }} | ||
- run: rustup install stable | ||
- run: rustup target add ${{ matrix.target }} | ||
- name: build | ||
shell: powershell | ||
run: cargo build -p l3_cli --release --target ${{ matrix.target }} | ||
- name: upload | ||
shell: powershell | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
RELEASE_ID: ${{ inputs.release_id }} | ||
UPLOAD_HOSTNAME: ${{ inputs.upload_hostname }} | ||
run: | | ||
Move-Item -Path target\${{ matrix.target }}\release\l3.exe -Destination ${{ matrix.filename }} | ||
Move-Item -Path .github/workflows/windows_upload_asset.mjs -Destination upload_asset.mjs | ||
npm i @octokit/core | ||
node upload_asset.mjs eighty4 l3 $env:RELEASE_ID ${{ matrix.filename }} application/x-dosexec $env:UPLOAD_HOSTNAME |
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,32 @@ | ||
const owner = process.argv[2] | ||
const repo = process.argv[3] | ||
const releaseId = process.argv[4] | ||
const filename = process.argv[5] | ||
const contentType = process.argv[6] | ||
const baseUrl = 'https://' + process.argv[7] | ||
|
||
import {Octokit} from '@octokit/core' | ||
|
||
const auth = process.env.GH_TOKEN | ||
|
||
const url = `POST /repos/${owner}/${repo}/releases/${releaseId}/assets?name=${filename}` | ||
|
||
const options = { | ||
baseUrl, | ||
owner, | ||
repo, | ||
release_id: releaseId, | ||
data: '@' + filename, | ||
headers: { | ||
'Accept': 'application/vnd.github+json', | ||
'Content-Type': contentType, | ||
'X-GitHub-Api-Version': '2022-11-28', | ||
}, | ||
} | ||
|
||
new Octokit({auth}).request(url, options) | ||
.then(() => console.log('finished')) | ||
.catch((e) => { | ||
console.error(e) | ||
process.exit(1) | ||
}) |
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
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 |
---|---|---|
@@ -1,15 +1,31 @@ | ||
use std::{path::Path, process::Command}; | ||
|
||
#[cfg(target_os = "windows")] | ||
pub fn unzip(archive_path: &Path, unzip_path: &Path) { | ||
let exit_code = Command::new("unzip") | ||
std::fs::create_dir_all(unzip_path).unwrap(); | ||
let output = Command::new("tar") | ||
.arg("-xf") | ||
.arg(archive_path) | ||
.arg("-C") | ||
.arg(unzip_path) | ||
.output() | ||
.unwrap(); | ||
if !output.status.success() { | ||
dbg!(output); | ||
panic!(); | ||
} | ||
} | ||
|
||
#[cfg(not(target_os = "windows"))] | ||
pub fn unzip(archive_path: &Path, unzip_path: &Path) { | ||
let output = Command::new("unzip") | ||
.arg(archive_path.to_string_lossy().to_string()) | ||
.arg("-d") | ||
.arg(unzip_path.to_string_lossy().to_string()) | ||
.spawn() | ||
.unwrap() | ||
.wait() | ||
.unwrap() | ||
.code() | ||
.output() | ||
.unwrap(); | ||
assert_eq!(0, exit_code); | ||
if !output.status.success() { | ||
dbg!(output); | ||
panic!(); | ||
} | ||
} |