1- //! Workflow for all tailcall projects free and open source for everyone.
1+ //! Workflow is designed to be used for most Rust projects that are built at
2+ //! Tailcall. Though gh-workflow makes it much easier to write workflows you
3+ //! still need to constantly keep referring to the Github documentation to write
4+ //! your own workflows. This module saves all that time by using feature flags
5+ //! to enable or disable features that you want in your workflow. Based on the
6+ //! features enabled or disabled a workflow is generated.
27
38use ctx:: Context ;
49use derive_setters:: Setters ;
5- use gh_workflow:: * ;
10+ use gh_workflow:: { Workflow as GHWorkflow , * } ;
611use release_plz:: { Command , Release } ;
712use toolchain:: Toolchain ;
813
9- #[ derive( Default , Debug , Clone , Setters ) ]
10- pub struct TailcallWorkflow {
11- pub release : bool ,
14+ #[ derive( Debug , Clone , Setters ) ]
15+ pub struct Workflow {
16+ /// When enabled, a release job is added to the workflow.
17+ /// *IMPORTANT:* Ensure `secrets.CARGO_REGISTRY_TOKEN` is set for your
18+ /// github action.
19+ pub auto_release : bool ,
20+
21+ /// Name of the workflow.
22+ pub name : String ,
1223}
1324
14- impl TailcallWorkflow { }
25+ impl Default for Workflow {
26+ fn default ( ) -> Self {
27+ Self { auto_release : true , name : "CI" . into ( ) }
28+ }
29+ }
1530
16- impl From < TailcallWorkflow > for Workflow {
17- fn from ( value : TailcallWorkflow ) -> Self {
31+ impl From < Workflow > for GHWorkflow {
32+ fn from ( value : Workflow ) -> Self {
1833 let flags = RustFlags :: deny ( "warnings" ) ;
1934
2035 let event = Event :: default ( )
@@ -33,12 +48,12 @@ impl From<TailcallWorkflow> for Workflow {
3348
3449 // Jobs
3550 let build = build_and_test ( ) ;
36- let mut workflow = Workflow :: new ( "CI" )
51+ let mut workflow = GHWorkflow :: new ( value . name )
3752 . add_env ( flags)
3853 . on ( event)
3954 . add_job ( "build" , build. clone ( ) ) ;
4055
41- if value. release {
56+ if value. auto_release {
4257 let permissions = Permissions :: default ( )
4358 . pull_requests ( Level :: Write )
4459 . packages ( Level :: Write )
0 commit comments