-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
149 lines (132 loc) · 4.78 KB
/
Taskfile.yaml
File metadata and controls
149 lines (132 loc) · 4.78 KB
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
---
version: 3
includes:
git:
taskfile: https://raw.githubusercontent.com/stuttgart-things/platform-engineering-showcase/refs/heads/main/taskfiles/git.yaml
vars:
PROJECT_NAME:
sh: echo ${PWD##*/}
BRANCH:
sh: if [ $(git rev-parse --abbrev-ref HEAD) != "main" ]; then echo $(git rev-parse --abbrev-ref HEAD); else echo main ; fi
dotenv: ['.env', '{{.HOME}}/.env']
tasks:
serve-presentation:
desc: Watch files in presentation/ and rerun task serve on changes
cmds:
- |
find {{ .dir }}/{{ .presentation }} -type f | entr -r \
dagger call -m {{ .daggerModule }} serve \
--config {{ .dir }}/{{ .presentation }}/hugo.toml \
--content {{ .dir }}/{{ .presentation }} \
--port {{ .port }} \
up --progress plain
silent: true
vars:
daggerModule: github.com/stuttgart-things/dagger/hugo@v0.12.0
port: 4427
dir: presentations
presentation:
sh: gum choose $(basename -a {{ .dir }}/*/ | grep -v '^tests$')
lint-repository:
desc: Lint repository using Dagger blueprint function
cmds:
- |
dagger call -m {{ .MODULE }}@{{ .VERSION }} {{ .FUNCTION }} \
--src {{ .CODE_DIR }} \
export --path {{ .EXPORT_PATH }}
vars:
MODULE: github.com/stuttgart-things/blueprints/repository-linting
VERSION: v1.15.0
FUNCTION: validate-multiple-technologies
CODE_DIR: "./"
EXPORT_PATH: /tmp/docs-repo-findings.txt
build-s3-push:
desc: Build static content
cmds:
- |
# CLEAN UP
rm -rf {{ .OUTPUT_PATH_STATIC }} || true
# BUILD STATIC CONTENT
dagger call -m {{ .HUGO_MODULE }} \
build-sync-export \
--name {{ .presentation }} \
--config {{ .dir }}/{{ .presentation }}/hugo.toml \
--content {{ .dir }}/{{ .presentation }} \
--endpoint {{ .s3Endpoint }} \
--bucket-name {{ .presentation }} \
--insecure={{ .s3Insecure }} \
--access-key=env:MINIO_USER \
--secret-key=env:MINIO_PASSWORD \
--alias-name artifacts \
export \
--path {{ .OUTPUT_PATH_STATIC }}
echo "FROM scratch" > {{ .OUTPUT_PATH_STATIC }}/Dockerfile
echo "COPY . /" >> {{ .OUTPUT_PATH_STATIC }}/Dockerfile
dagger call -m {{ .DOCKER_MODULE }} \
build-and-push \
--source {{ .OUTPUT_PATH_STATIC }} \
--repository-name {{ .REPOSITORY }}/{{ .presentation }} \
--registry-url {{ .REGISTRY }} \
--version {{ .VERSION }} \
--progress plain \
--with-registry-username=env:GITHUB_USER \
--with-registry-password=env:GITHUB_TOKEN \
-vv
vars:
DOCKER_MODULE: github.com/stuttgart-things/dagger/docker@v0.11.1
HUGO_MODULE: github.com/stuttgart-things/dagger/hugo@v0.12.0
dir: presentations
s3Endpoint: https://play.min.io
s3Insecure: true
presentation:
sh: gum choose $(basename -a {{ .dir }}/*/)
OUTPUT_PATH_STATIC: /tmp/hugo/static/{{ .presentation }}
VERSION:
sh: date +"%Y%m%d-%H%M%S"
REPOSITORY: stuttgart-things
REGISTRY: ghcr.io
build:
desc: Build static content
cmds:
- |
# CLEAN UP
rm -rf {{ .OUTPUT_PATH_STATIC }} || true
# BUILD STATIC CONTENT
dagger call -m {{ .MODULE }} \
build-and-export \
--name {{ .presentation }} \
--config {{ .dir }}/{{ .presentation }}/hugo.toml \
--content {{ .dir }}/{{ .presentation }} \
export --path {{ .OUTPUT_PATH_STATIC }}
vars:
#MODULE: github.com/stuttgart-things/dagger/hugo@v0.11.0
MODULE: /home/sthings/projects/dagger/hugo
dir: presentations
presentation:
sh: gum choose $(basename -a {{ .dir }}/*/)
OUTPUT_PATH_STATIC: /tmp/hugo/static/{{ .presentation }}
do:
desc: Select a task to run
cmds:
- |
# Extract task names (keep internal colons, remove only trailing colon)
task_name=$(task -l | awk '/^\*/ {print $2}' | sed 's/:$//' | gum choose)
# Run the selected task
[ -n "$task_name" ] && task "$task_name"
default:
desc: Default task is select & do (work)
cmds:
- task do
lychee:
desc: Check links with lychee
cmds:
- |
LYCHEE=$(command -v lychee 2>/dev/null) || true
if [ -z "$LYCHEE" ]; then
LYCHEE_VERSION='v0.15.1' # current stable version
LYCHEE_TMP='/tmp/'
LYCHEE_FILE="${LYCHEE_TMP}lychee-${LYCHEE_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
wget "https://github.com/lycheeverse/lychee/releases/download/${LYCHEE_VERSION}/lychee-${LYCHEE_VERSION}-x86_64-unknown-linux-gnu.tar.gz" -O "$LYCHEE_FILE"
tar -C /usr/local/bin -xzvf "$LYCHEE_FILE"
fi
- git ls-files | grep -E -v '.png$|.ico$' | xargs lychee