Commit bdae32a 1 parent babfd8a commit bdae32a Copy full SHA for bdae32a
File tree 10 files changed +60
-61
lines changed
10 files changed +60
-61
lines changed Original file line number Diff line number Diff line change 14
14
os : [ubuntu-latest, macos-latest, windows-latest]
15
15
steps :
16
16
- name : Deploy Rust to GitHub Pages
17
- uses :
valkyrie-language/[email protected] .0
17
+ uses :
valkyrie-language/[email protected] .1
18
18
with :
19
19
config : .config/Publish.toml
Original file line number Diff line number Diff line change 1
- cargo build --release --target wasm32-wasip2
1
+ cargo component build --release --target wasm32-wasip2
2
2
cp target/wasm32-wasip2/release/github.wasm projects/publish-wasm32-wasi/github-wasm32-wasi.wasm
3
3
jco transpile projects/publish-wasm32-wasi/github-wasm32-wasi.wasm -o projects/publish-wasm32-wasi/src --name index --no-namespaced-exports --multi-memory --valid-lifting-optimization --optimize
Original file line number Diff line number Diff line change
1
+ name : Rust Auto Publish
2
+ description : Auto publish rust binary to github release
3
+
4
+ branding :
5
+ icon : package
6
+ color : orange
7
+ runs :
8
+ using : node20
9
+ main : rust-publish.js
10
+ env :
11
+ GITHUB_TOKEN : Secret provided by github.com
12
+ CRATES_TOKEN : Secret provided by crates.io
13
+ inputs :
14
+ config :
15
+ description : Path of the config file
16
+ required : true
17
+ default : .config/rust-publish.toml
18
+ outputs :
19
+ DEPLOYMENT_STATUS :
20
+ description : ' The status of the deployment that indicates if the run failed or passed. Possible outputs include: success|failed|skipped'
Original file line number Diff line number Diff line change @@ -9,13 +9,11 @@ readme = "readme.md"
9
9
license = " MPL-2.0"
10
10
edition = " 2021"
11
11
12
+ [lib ]
13
+ name = " github"
14
+ crate-type = [" cdylib" ]
15
+
12
16
[dependencies ]
13
- anyhow = " 1.0.95"
14
- clap = { version = " 4.5.27" , features = [" derive" ] }
15
- # url = "2.5.4"
16
- wat = { version = " 1.224.0" , features = [" component-model" , " dwarf" ] }
17
- wasmprinter = { version = " 0.224.0" , features = [" component-model" ] }
18
- js-component-bindgen = " 1.9.1"
19
17
reqwest = { version = " 0.12.12" , features = [" socks" ] }
20
18
# inquire = "0.7.5"
21
19
dialoguer = " 0.11.0"
Original file line number Diff line number Diff line change
1
+ use crate :: {
2
+ GithubError , bindings,
3
+ bindings:: { Guest , export} ,
4
+ } ;
5
+
6
+ pub struct RunningContext { }
7
+
8
+ impl Guest for RunningContext {
9
+ fn run_with_config ( config : String ) -> Result < ( ) , GithubError > {
10
+ tokio:: runtime:: Builder :: new_current_thread ( ) . enable_all ( ) . build ( ) ?. block_on ( async {
11
+ let ctx = RunningContext { } ;
12
+ ctx. run ( config) . await
13
+ } )
14
+ }
15
+ }
16
+
17
+ impl RunningContext {
18
+ async fn run ( & self , config : String ) -> Result < ( ) , GithubError > {
19
+ let args = std:: env:: args ( ) ;
20
+ println ! ( "Args: {:?}" , args) ;
21
+ println ! ( "Config: {}" , config) ;
22
+ Ok ( ( ) )
23
+ }
24
+ }
25
+
26
+ export ! ( RunningContext with_types_in bindings) ;
Original file line number Diff line number Diff line change @@ -6,18 +6,6 @@ impl From<std::io::Error> for GithubError {
6
6
}
7
7
}
8
8
9
- impl From < anyhow:: Error > for GithubError {
10
- fn from ( error : anyhow:: Error ) -> Self {
11
- GithubError :: Custom ( error. to_string ( ) )
12
- }
13
- }
14
-
15
- impl From < wat:: Error > for GithubError {
16
- fn from ( error : wat:: Error ) -> Self {
17
- GithubError :: Custom ( error. to_string ( ) )
18
- }
19
- }
20
-
21
9
impl From < dialoguer:: Error > for GithubError {
22
10
fn from ( error : dialoguer:: Error ) -> Self {
23
11
GithubError :: Custom ( error. to_string ( ) )
Original file line number Diff line number Diff line change 1
- pub mod commands;
1
+ pub mod bindings;
2
+ mod commands;
2
3
mod errors;
3
- pub use crate :: bindings:: GithubError ;
4
- use crate :: commands:: { LegionArguments , LegionCommands } ;
5
- use clap:: Parser ;
6
- mod bindings;
7
4
8
- #[ derive( Debug , Parser ) ]
9
- #[ command( version, about, long_about = None ) ]
10
- pub struct GithubCLI {
11
- #[ command( subcommand) ]
12
- commands : Option < LegionCommands > ,
13
- #[ command( flatten) ]
14
- arguments : LegionArguments ,
15
- }
16
-
17
- impl GithubCLI {
18
- pub async fn run ( self ) -> Result < ( ) , GithubError > {
19
- let args: Vec < String > = std:: env:: args ( ) . collect ( ) ;
20
- println ! ( "Args:\n {:#?}" , args) ;
21
- // let Self { commands, arguments } = self;
22
- // match commands {
23
- // Some(s) => s.run(&arguments).await?,
24
- // None => {}
25
- // }
26
- Ok ( ( ) )
27
- }
28
- }
5
+ pub use crate :: { bindings:: GithubError , commands:: RunningContext } ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 8
8
using : node20
9
9
main : rust-publish.js
10
10
env :
11
- GITHUB_TOKEN : As provided by Github Actions
11
+ GITHUB_TOKEN : Secret provided by github.com
12
+ CRATES_TOKEN : Secret provided by crates.io
12
13
inputs :
13
14
config :
14
15
description : Path of the config file
15
16
required : true
16
- default : ' {json} '
17
+ default : .config/rust-publish.toml
17
18
outputs :
18
19
DEPLOYMENT_STATUS :
19
20
description : ' The status of the deployment that indicates if the run failed or passed. Possible outputs include: success|failed|skipped'
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
2
3
3
import { getInput } from '@actions/core' ;
4
- import { run } from "./src/index.js" ;
4
+ import { runWithConfig } from "./src/index.js" ;
5
5
6
- const name = getInput ( 'name' ) ;
7
-
8
- run . run ( )
6
+ runWithConfig ( getInput ( 'config' ) )
You can’t perform that action at this time.
0 commit comments