aboutsummaryrefslogtreecommitdiff
path: root/ci/taskfile.yaml
blob: fdf12b08f81bcc815d17a7e648a4ad032e8e5d21 (plain)
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
# https://taskfile.dev

#Called by the vnbuild system to produce builds for my website
#https://www.vaughnnugent.com/resources/software

version: "3"

vars:
  BUILDS_URL: https://www.vaughnnugent.com/public/resources/software/builds
 

includes:
  plugins:
    taskfile: plugins.taskfile.yaml

tasks:

  build:
    cmds:
    - task: install-plugins
    - task: install-webserver

  install-webserver:
    cmds:
    #setup env
    - task: create-env
      vars:
        TARGET_OS: win-x64

    - task: create-env
      vars:
        TARGET_OS: linux-x64

    - task: create-env
      vars:
        TARGET_OS: osx-x64


  postbuild_success:
    cmds:
    #make bin dir
    - cmd: powershell -Command "mkdir bin -Force"
      ignore_error: true

    - task: pack
      vars:
        TARGET_OS: win-x64
    - task: pack
      vars:
        TARGET_OS: linux-x64
    - task: pack
      vars:
        TARGET_OS: osx-x64


  install-plugins:
    cmds:
    #add plugins
    - task: plugins:all
    
  create-env:
    vars:
      BUILD_DIR: './build/{{.TARGET_OS}}'
    cmds:
    #create dir for env
    - cmd: powershell -Command "mkdir {{.BUILD_DIR}} -Force"
      ignore_error: true
    
    #copy plugins
    - cmd: powershell -Command "cp -Recurse -Force plugins {{.BUILD_DIR}}"

    #copy wwwroot
    - cmd: powershell -Command "cp -Recurse -Force dist {{.BUILD_DIR}}"
    
    - task: get-webserver
      vars:
        TARGET_OS: '{{.TARGET_OS}}'
        BUILD_DIR: '{{.BUILD_DIR}}'
  

  get-webserver:
    internal: true
    cmds:
    #install accounts plugin
    - task: install
      vars:
        NAME: 'webserver'
        PROJECT_NAME: 'VNLib.Webserver'
        MODULE_NAME: "VNLib.Webserver"
        FILE_NAME: "{{.TARGET_OS}}-release.tgz"
        BUILD_DIR: '{{.BUILD_DIR}}'

    - cmd: powershell -Command "cp -Force ./config/config.json {{.BUILD_DIR}}/config.json"

  install:
    internal: true
    vars:
      DIR: '"{{.BUILD_DIR}}"/"{{.NAME}}"'
    cmds:
    #make the plugin directory
    - cmd: powershell -Command "mkdir {{.DIR}} -Force"
      ignore_error: true
    - cd {{.DIR}} && powershell "{{.USER_WORKING_DIR}}/install.ps1" -BaseUrl {{.BUILDS_URL}} -ModuleName {{.MODULE_NAME}} -ProjectName {{.PROJECT_NAME}} -FileName {{.FILE_NAME}}
    - cd {{.DIR}} && tar -xzf {{.FILE_NAME}}    
    #remove the tar file
    - cd {{.DIR}} && powershell -Command "rm {{.FILE_NAME}}"
 
  pack:
    internal: true
    cmds:
    - cmd: powershell -Command "mkdir build/{{.TARGET_OS}}/ -Force"
      ignore_error: true
    - cd build/{{.TARGET_OS}} && tar -czf ../../bin/{{.TARGET_OS}}-release.tgz .
 

  clean:
    ignore_error: true
    cmds:
    - cmd: powershell -Command "rm -Recurse -Force ./build"
    - cmd: powershell -Command "rm -Recurse -Force ./bin"
    - cmd: powershell -Command "rm -Recurse -Force ./dist"
    - cmd: powershell -Command "rm -Recurse -Force ./plugins"