-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
171 lines (136 loc) · 3.72 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
version: '3'
vars:
PRJ_DIR: cafram
includes:
dev:
taskfile: ./scripts/Taskfile.yml
dir: .
optional: true
doc:
taskfile: ./docs/Taskfile.yml
dir: ./docs
optional: true
docker:
taskfile: ./docker/Taskfile.yml
optional: true
tasks:
# Generic helpers
# -----------------
default:
desc: Show all commands
cmds:
- task --list-all
# Project helpers
# -----------------
bootstrap:
desc: Bootstrap environment
sources:
- poetry.lock
cmds:
- 'poetry --version >&/dev/null || pip install --upgrade poetry'
- poetry config --list
- poetry install -vv --no-interaction --no-root
- not poetry run pre-commit --version &>/dev/null || poetry run pre-commit install --install-hooks
setup:
desc: Setup project
deps:
- bootstrap
sources:
- "{{.PRJ_DIR}}/*"
cmds:
- poetry install -vv --no-interaction --only-root
update:
desc: Synchronize git
cmds:
- git fetch -a && git pull
- task: setup
# Build workflow
# -----------------
build:
desc: Create a python package
run: once
# Used by semantic-release during publish process, as pre-commit command
#sources:
# - pyproject.toml
cmds:
- task: clean
- poetry build
- cp CHANGELOG.md dist/CHANGELOG.md
- cp VERSION_NOTES.md dist/RELEASE.md
clean:
desc: Clean generated packages
status:
- test ! -d dist/
cmds:
- rm -rf dist/ && mkdir -p dist
# Release workflow
# -----------------
release_changelog:
desc: "Used by semantic-release during publish process, as pre-commit command"
cmds:
- poetry run semantic-release changelog --unreleased > VERSION_NOTES.md
release_status:
desc: Show release status
cmds:
- poetry run ./scripts/versions.sh
release_stable:
desc: Bump code stable version, generate changelog, create a tag
# Note having :
# GH_TOKEN set will create a release in github
# PYPI_TOKEN set will release a version on pypi
preconditions:
- sh: >
[[ "$(git rev-parse --abbrev-ref HEAD)" == main ]]
msg: You must checkout 'main' branch first
- sh: >
! git status -s | grep -E '^[AM]* '
msg: You must clean your working dir first
cmds:
- SKIP=end-of-file-fixer poetry run semantic-release -D tag_commit=true publish
- task: publish_gh
- task: publish_pypi
- task: doc:publish_gh
release_beta:
aliases:
- release
desc: Bump code stable version, generate changelog, create a tag
preconditions:
- sh: '[[ "$(git rev-parse --abbrev-ref HEAD)" == develop ]]'
msg: You must checkout 'develop' branch first
- sh: ! git status -s | grep -E '^[AM]* '
msg: You must clean your working dir first
cmds:
- >
SKIP=end-of-file-fixer poetry run semantic-release
-D tag_commit=true
-D branch=develop
publish --prerelease
- task: publish_gh
- task: publish_pypi
- task: doc:publish_gh
# Publish workflow
# -----------------
publish_pypi:
desc: Publish python package on pypi.org
deps:
- build
cmds:
- poetry publish
publish_gh:
desc: Publish python packge on a github release
env:
INPUT_PRERELEASE: false
INPUT_ALLOW_OVERRIDE: true
vars:
INPUT_TOKEN:
sh: echo "$GH_TOKEN"
BODY_HEADER: |
## What's new in this version ?
This release has been published: $(date --utc)
## List of changes:
$(cat VERSION_NOTES.md)
deps:
- build
cmds:
- ls -ahl dist/
- INPUT_BODY="{{.BODY_HEADER}}" INPUT_TOKEN={{.INPUT_TOKEN}} bash scripts/publish_github.sh