Skip to content

Commit

Permalink
run version bump command from vscode tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
kferrone committed Oct 28, 2024
1 parent 5475e32 commit f4ff426
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 6 deletions.
48 changes: 42 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@
"IMAGE": "duplocloud/duploctl",
}
},
"inputs": [
{
"id": "runner-token",
"type": "promptString",
"description": "Enter the GHA Runner Token"
},
{
"id": "action",
"type": "pickString",
"description": "Select the action to perform",
"default": "patch",
"options": [
"patch",
"minor",
"major"
]
},
{
"id": "push",
"type": "pickString",
"description": "Push the changes to the remote",
"default": "false",
"options": [
"true",
"false"
]
}
],
"tasks": [
{
"type": "process",
Expand Down Expand Up @@ -167,13 +195,21 @@
"${input:runner-token}"
],
"echoCommand": true
}
],
"inputs": [
},
{
"id": "runner-token",
"type": "promptString",
"description": "Enter the GHA Runner Token"
"label": "Bump Version",
"detail": "Bump the version and release the package",
"group": "build",
"icon": {
"color": "terminal.ansiGreen",
"id": "file-binary"
},
"type": "process",
"command": "scripts/bump.sh",
"args": [
"${input:action}",
"${input:push}"
]
}
]
}
40 changes: 40 additions & 0 deletions scripts/bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# make sure the first parameter is either patch, minor, or major
if [ "$1" != "patch" ] && [ "$1" != "minor" ] && [ "$1" != "major" ]; then
echo "Usage: bump.sh [patch|minor|major]"
exit 1
fi

# make sure the second parameter is a true or false value
if [ "$2" != "true" ] && [ "$2" != "false" ]; then
echo "Usage: bump.sh [patch|minor|major] [true|false]"
exit 1
fi

echo "Doing a $1 and pushing is $2"

unset GITHUB_TOKEN
gh auth status || gh auth login --hostname github.com --git-protocol ssh --web --skip-ssh-key

gh workflow run publish.yml \
--ref main \
-f "action=$1" \
-f "push=$2" \
-f "include_mac_arm64=true"

# while the JOB_ID is empty keep trying to get it every three seconds, but only try 7 times
while [ -z "$JOB_ID" ]; do
((count++)) && ((count == 10)) && break
JOB_ID="$(gh run list --workflow publish.yml --status in_progress --json databaseId --jq '.[0].databaseId')"
sleep 3
echo "Waiting for the job to start...$count $JOB_ID"
done

echo "Found Job(${JOB_ID})"

gh run watch "$JOB_ID"

echo "Job($JOB_ID) finished"

gh run view "$JOB_ID"

0 comments on commit f4ff426

Please sign in to comment.