1
+ name : Build and Publish
2
+
3
+ on :
4
+ release :
5
+ types : [published]
6
+
7
+ jobs :
8
+ get_published_release :
9
+ runs-on : ubuntu-latest
10
+
11
+ outputs :
12
+ release_id : ${{ steps.release_info.outputs.release_id }}
13
+ upload_url : ${{ steps.release_info.outputs.upload_url }}
14
+ tag_name : ${{ steps.release_info.outputs.tag_name }}
15
+ repo_desc : ${{ steps.release_info.outputs.repo_desc }}
16
+ repo_name : ${{ steps.release_info.outputs.repo_name }}
17
+ repo_owner_name : ${{ steps.release_info.outputs.repo_owner_name }}
18
+ steps :
19
+ - name : Set Release Info
20
+ id : release_info
21
+ run : |
22
+ echo "::set-output name=tag_name::${{ github.event.release.tag_name }}"
23
+ echo "::set-output name=release_id::${{ github.event.release.id }}"
24
+ echo "::set-output name=upload_url::${{ github.event.release.upload_url }}"
25
+
26
+ repo_owner_name=${{ github.repository_owner }}
27
+ echo "::set-output name=repo_owner_name::$repo_owner_name"
28
+
29
+ repo_name=${{ github.repository }}
30
+ forward_repo_pattern="${repo_owner_name}/"
31
+ empty_str=""
32
+ repo_name="${repo_name/${forward_repo_pattern}/${empty_str}}"
33
+ echo "::set-output name=repo_name::$repo_name"
34
+
35
+ # Use the GitHub API to fetch the repository description
36
+ description_prefix="\"description\":"
37
+ curl -L "https://api.github.com/repos/${repo_owner_name}/${repo_name}" > "desc.text"
38
+ desc=$(<desc.text)
39
+ desc=$(echo "$desc" | grep -F "$description_prefix")
40
+ desc="${desc/${description_prefix}/${empty_str}}"
41
+ repo_desc=$(echo "$desc" | grep -o '"[^"]*"')
42
+ echo "::set-output name=repo_desc::$repo_desc"
43
+
44
+ build_and_publish_to_wally :
45
+ needs : get_published_release
46
+ runs-on : windows-latest
47
+
48
+ steps :
49
+ # Checkout your Git repo
50
+ - uses : actions/checkout@v2
51
+
52
+ # Install foreman and all foreman tools
53
+ - uses : Roblox/setup-foreman@v1
54
+ with :
55
+ token : ${{ secrets.GITHUB_TOKEN }}
56
+
57
+ # Install wally packages
58
+ - name : update wally packages
59
+ run : wally-update patch
60
+
61
+ - name : install wally packages
62
+ run : wally install
63
+
64
+ - name : generate sourcemap
65
+ run : rojo sourcemap dev.project.json --output sourcemap.json
66
+
67
+ - name : export wally package types
68
+ run : wally-package-types --sourcemap sourcemap.json Packages
69
+
70
+ - name : Install testing files
71
+ shell : bash
72
+ run : |
73
+ # type definitions
74
+ if [ ! -d "types" ]; then
75
+ mkdir "types"
76
+ fi
77
+ curl -L "https://gist.github.com/nightcycle/50ca8f42147077b8f584b503030c8500/raw" > "types/testEZ.d.lua"
78
+ curl -L "https://gist.github.com/nightcycle/ae7ea3376337512772d1d2b314ef467b/raw" > "types/remodel.d.lua"
79
+ curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.lua" > "types/globalTypes.d.lua"
80
+
81
+ # lint definitions
82
+ if [ ! -d "lints" ]; then
83
+ mkdir "lints"
84
+ fi
85
+ curl -L "https://gist.github.com/nightcycle/a57e04de443dfa89bd08c8eb001b03c6/raw" > "lints/lua51.yml"
86
+ curl -L "https://gist.github.com/nightcycle/93c4b9af5bbf4ed09f39aa908dffccd0/raw" > "lints/luau.yml"
87
+
88
+ # apply code styling
89
+ - name : style src scripts
90
+ run : stylua src
91
+
92
+ - name : style built scripts
93
+ shell : bash
94
+ run : |
95
+ if [ ! -d "out" ]; then
96
+ mkdir "out"
97
+ fi
98
+ stylua out
99
+
100
+ - name : generate sourcemap
101
+ run : rojo sourcemap dev.project.json --output sourcemap.json
102
+
103
+ # Test validity
104
+ - name : typecheck src files
105
+ run : luau-lsp analyze --sourcemap="sourcemap.json" --ignore="Packages/**" --ignore="src/Server/NPC/Animate.server.lua" --ignore="**/Packages/**" --ignore="*.spec.luau" --ignore="out/**" --flag:LuauTypeInferIterationLimit=0 --flag:LuauCheckRecursionLimit=0 --flag:LuauTypeInferRecursionLimit=0 --flag:LuauTarjanChildLimit=0 --flag:LuauTypeInferTypePackLoopLimit=0 --flag:LuauVisitRecursionLimit=0 --definitions=types/globalTypes.d.lua --flag:LuauParseDeclareClassIndexer=true src
106
+
107
+ - name : lint src files
108
+ run : selene src
109
+
110
+ - name : Update version and labels
111
+ shell : bash
112
+ run : |
113
+ repo_owner="${{needs.get_published_release.outputs.repo_owner_name}}"
114
+ repo_name="${{needs.get_published_release.outputs.repo_name}}"
115
+ repo_desc=${{needs.get_published_release.outputs.repo_desc}}
116
+ goal_version_str="${{needs.get_published_release.outputs.tag_name}}"
117
+
118
+ # remove letters
119
+ goal_version_str=$(echo "$goal_version_str" | sed 's/[a-zA-Z]//g')
120
+
121
+ # read file
122
+ wally_toml_contents=$(<wally.toml)
123
+
124
+ # swap out version
125
+ goal_version_line="version = \"${goal_version_str}\""
126
+ target_version_line=$(echo "$wally_toml_contents" | grep -F "version = ")
127
+ wally_toml_contents="${wally_toml_contents/${target_version_line}/${goal_version_line}}"
128
+
129
+ # swap out name
130
+ goal_name_line="name = \"${repo_owner}/${repo_name}\""
131
+ target_name_line=$(echo "$wally_toml_contents" | grep -F "name = ")
132
+ wally_toml_contents="${wally_toml_contents/${target_name_line}/${goal_name_line}}"
133
+
134
+ # swap out description
135
+ goal_desc_line="description = \"${repo_desc}\""
136
+ target_desc_line=$(echo "$wally_toml_contents" | grep -F "description = ")
137
+ wally_toml_contents="${wally_toml_contents/${target_desc_line}/${goal_desc_line}}"
138
+
139
+ # update file
140
+ echo "$wally_toml_contents" > "wally.toml"
141
+
142
+ # read json file
143
+ default_json_contents=$(<default.project.json)
144
+ target_json_name_line=$(echo "$default_json_contents" | grep -F "\"name\": ")
145
+ goal_json_name_line=" \"name\": \"${repo_name}\","
146
+ default_json_contents="${default_json_contents/${target_json_name_line}/${goal_json_name_line}}"
147
+
148
+ # update file
149
+ echo "$default_json_contents" > "default.project.json"
150
+
151
+ - name : Build place file
152
+ run : |
153
+ rojo build dev.project.json -o Package.rbxl
154
+
155
+ - name : Upload Package.rbxl file to release
156
+ uses : actions/upload-release-asset@v1
157
+ env :
158
+ GITHUB_TOKEN : ${{ secrets.RELEASE_TOKEN }}
159
+ with :
160
+ upload_url : ${{ needs.get_published_release.outputs.upload_url }}
161
+ asset_path : Package.rbxl
162
+ asset_name : Package.rbxl
163
+ asset_content_type : application/octet-stream
164
+
165
+ - name : Publish release to Wally
166
+ shell : bash
167
+ run : |
168
+ wally login --token "${{secrets.WALLY_TOKEN}}"
169
+ wally publish
0 commit comments