-
Notifications
You must be signed in to change notification settings - Fork 2
216 lines (178 loc) · 6.44 KB
/
release.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Release
on:
release:
types: [published]
jobs:
get-version:
name: Get version from release tag
runs-on: ubuntu-latest
outputs:
tag-name: ${{ steps.output-version.outputs.tag_name }}
version-with-dots: ${{ steps.output-version.outputs.version_with_dots }}
version-with-dashes: ${{ steps.output-version.outputs.version_with_dashes }}
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Output version and tag name
id: output-version
run: |
# Get the tag name (e.g., v0.1.0)
tag_name="${{ github.event.release.tag_name }}"
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name"
# Strip the leading 'v' to get the version (e.g., 0.1.0)
version_with_dots="${tag_name#v}"
echo "version_with_dots=$version_with_dots" >> $GITHUB_OUTPUT
echo "version_with_dots=$version_with_dots"
# Replaces . with - for use in filenames (e.g., 0-1-0)
version_with_dashes="${version_with_dots//./-}"
echo "version_with_dashes=$version_with_dashes" >> $GITHUB_OUTPUT
echo "version_with_dashes=$version_with_dashes"
install-tools:
name: Install tools and dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install Rokit
uses: CompeyDev/[email protected]
- name: Setup Lune
run: lune setup
- name: Install dependencies with Wally
run: wally install
- name: Cache installed items
uses: actions/[email protected]
with:
path: |
~/.rokit
~/.lune
Packages
DevPackages
key: tools-${{ hashFiles('rokit.toml') }}
preprocess-release:
name: Preprocess release (update versions, copyright years)
runs-on: ubuntu-latest
needs: [install-tools, get-version]
environment: Release Preprocessor
permissions:
contents: write
steps:
- uses: actions/[email protected]
id: release-preprocessor-bot-token
with:
app-id: ${{ vars.RELEASE_PREPROCESSOR_APP_ID }}
private-key: ${{ secrets.RELEASE_PREPROCESSOR_PRIVATE_KEY }}
- name: Checkout code
uses: actions/[email protected]
with:
token: ${{ steps.release-preprocessor-bot-token.outputs.token }}
- name: Restore installed items
uses: actions/[email protected]
with:
path: |
~/.rokit
~/.lune
Packages
DevPackages
key: tools-${{ hashFiles('rokit.toml') }}
- name: Add rokit tools to PATH
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
- name: Locally update version & copyright year in files
run: lune run preprocessRelease ${{ needs.get-version.outputs.version-with-dots }}
- name: Commit version & copyright year updates
uses: stefanzweifel/[email protected]
with:
commit_message: "Preprocess release for version ${{ needs.get-version.outputs.version-with-dots }}"
branch: main
file_pattern: "README.md wally.toml src/StateQ/init.luau LICENSE.md"
create-release-artifacts:
name: Create release artifacts
runs-on: ubuntu-latest
needs: [install-tools, get-version, preprocess-release]
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Restore installed items
uses: actions/[email protected]
with:
path: |
~/.rokit
~/.lune
Packages
DevPackages
key: tools-${{ hashFiles('rokit.toml') }}
- name: Add rokit tools to PATH
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
- name: Build release artifacts
run: lune run build ${{ needs.get-version.outputs.version-with-dashes }}
- name: Cache artifacts
uses: actions/[email protected]
with:
path: |
build
wally.toml
key: artifacts-${{ needs.get-version.outputs.tag-name }}
publish-wally-artifact:
name: Publish release artifact to Wally
runs-on: ubuntu-latest
needs:
[install-tools, get-version, preprocess-release, create-release-artifacts]
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Restore installed items
uses: actions/[email protected]
with:
path: |
~/.rokit
~/.lune
Packages
DevPackages
key: tools-${{ hashFiles('rokit.toml') }}
- name: Restore build artifacts
uses: actions/[email protected]
with:
path: |
build
wally.toml
key: artifacts-${{ needs.get-version.outputs.tag-name }}
- name: Add rokit tools to PATH
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
- name: Log in to Wally
run: wally login --token ${{ secrets.WALLY_ACCESS_TOKEN }}
- name: Publish package to Wally
run: wally publish
upload-github-artifacts:
name: Upload artifacts to the GitHub release
runs-on: ubuntu-latest
needs: [get-version, create-release-artifacts]
permissions:
contents: write
steps:
- name: Restore build artifacts
uses: actions/[email protected]
with:
path: |
build
wally.toml
key: artifacts-${{ needs.get-version.outputs.tag-name }}
- name: Print files
run: ls -R
- name: Upload zip artifact to the GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/zip/StateQ-${{ needs.get-version.outputs.version-with-dashes}}.zip
asset_name: StateQ-${{ needs.get-version.outputs.version-with-dashes}}.zip
asset_content_type: application/zip
- name: Upload rbxm artifact to the GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/rbxm/StateQ-${{ needs.get-version.outputs.version-with-dashes }}.rbxm
asset_name: StateQ-${{ needs.get-version.outputs.version-with-dashes }}.rbxm
asset_content_type: application/octet-stream