T
Task3mo ago
trim21

is it possible to set vars in cmds?

I need a run a command before vars are defined, it this possible? for example:
pkg-manager bump patch
VERSION=$(pkg-manager get current version)
git commit -m "bump: {{.VERSION}}"
git tag "v{{.VERSION}}" -m "v{{.VERSION}}"
pkg-manager bump patch
VERSION=$(pkg-manager get current version)
git commit -m "bump: {{.VERSION}}"
git tag "v{{.VERSION}}" -m "v{{.VERSION}}"
1 Reply
trim21
trim213mo ago
this can be done by adding a internal task:
bump:
cmds:
- poetry version {{.CLI_ARGS}}
- git add pyproject.toml
- task: bump-commit

bump-commit:
internal: true
vars:
VERSION:
sh: poetry version -s
cmds:
- 'git commit -m "bump: {{.VERSION}}"'
- 'git tag "v{{.VERSION}}" -m "v{{.VERSION}}"'
bump:
cmds:
- poetry version {{.CLI_ARGS}}
- git add pyproject.toml
- task: bump-commit

bump-commit:
internal: true
vars:
VERSION:
sh: poetry version -s
cmds:
- 'git commit -m "bump: {{.VERSION}}"'
- 'git tag "v{{.VERSION}}" -m "v{{.VERSION}}"'