Skip to content

Commit

Permalink
Merge pull request #34 from iamando/develop
Browse files Browse the repository at this point in the history
feat: create a github action to check install script and deno
  • Loading branch information
Ando authored Nov 17, 2023
2 parents 39ccdac + 025ae7c commit 70dd595
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: pull-request

on: push

jobs:
install-compiled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: denolib/setup-deno@v2
with:
deno-version: 1.37.1
- run: |
chmod +x scripts/install.sh
./scripts/install.sh
- run: |
if command -v deno &>/dev/null; then
echo "Deno is installed."
deno --version
else
echo "Deno installation failed."
exit 1
fi
- run: |
if command -v cocli &>/dev/null; then
echo "Cocli is installed globally."
cocli --version
else
echo "Cocli installation globally failed."
exit 1
fi
9 changes: 8 additions & 1 deletion cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { green, yellow } from './deps.ts'
import { green, yellow, parseFlags } from './deps.ts'
import {
isGitRepository,
isTreeClean,
Expand All @@ -16,6 +16,13 @@ import {

// Learn more at https://deno.land/manual/examples/module_metadata#concepts
if (import.meta.main) {
const { flags } = parseFlags(Deno.args)

if (flags.version) {
console.log('v0.1.0')
Deno.exit(1)
}

console.log(green('-'.repeat(50)))
console.log()
console.log('Cocli - v0.1.0 🌱🚀')
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"importMap": "./import_map.json",
"tasks": {
"start": "deno run --allow-all --unstable --import-map=import_map.json cli.ts",
"dev": "deno run --watch cli.ts"
"start": "deno run -A cli.ts",
"dev": "deno run -A --watch cli.ts"
}
}
11 changes: 11 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export {
Input,
Confirm,
} from 'https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/mod.ts'
export { parseFlags } from 'https://deno.land/x/cliffy@v1.0.0-rc.3/flags/mod.ts'
export {
green,
dim,
Expand Down
5 changes: 5 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ if ! is_deno_installed; then
install_deno
fi

export DENO_INSTALL="/home/runner/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

# Build the Deno project
echo "Compiling Cocli...📦"
deno compile -A --output cocli https://deno.land/x/cocli/cli.ts
echo "Compilation finished..✅"

if [[ -f cocli ]]; then
echo "Executable compiled successfully.📦"
Expand Down

0 comments on commit 70dd595

Please sign in to comment.