File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : " Setup MyCLI"
2+ description : " Installs MyCLI and adds it to the PATH"
3+ author : " Your Name"
4+
5+ inputs :
6+ version :
7+ description : " The CLI version to install"
8+ required : false
9+ default : " latest"
10+
11+ runs :
12+ using : " node16"
13+ main : " index.js"
Original file line number Diff line number Diff line change 1+ const core = require ( '@actions/core' ) ;
2+ const { execSync } = require ( 'child_process' ) ;
3+
4+ async function run ( ) {
5+ try {
6+ const version = core . getInput ( 'version' ) || 'latest' ;
7+
8+ console . log ( `Installing MyCLI version: ${ version } ...` ) ;
9+
10+ execSync ( `curl -fsSL https://cli.example.com/install.sh | sh` , { stdio : 'inherit' } ) ;
11+
12+ console . log ( "MyCLI installed successfully." ) ;
13+ } catch ( error ) {
14+ core . setFailed ( `Installation failed: ${ error . message } ` ) ;
15+ }
16+ }
17+
18+ run ( ) ;
Original file line number Diff line number Diff line change 1+ name : Test MyCLI Setup
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - feature/*
8+ jobs :
9+ test :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout repository
13+ uses : actions/checkout@v4
14+
15+ - name : Install MyCLI
16+ uses : ./.github/actions/my-cli-action
17+ with :
18+ version : ' 1.2.3'
19+
20+ - name : Verify CLI Installation
21+ run : |
22+ echo "Checking MyCLI version..."
23+ mycli --version
You can’t perform that action at this time.
0 commit comments