Skip to content

Commit 732b4e2

Browse files
committed
initial
0 parents  commit 732b4e2

46 files changed

Lines changed: 7242 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
package:
13+
name: Package mod
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Validate release version
23+
shell: bash
24+
run: |
25+
set -euo pipefail
26+
27+
VERSION="$(jq -r '.version' mod.txt)"
28+
29+
if [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" != "v${VERSION}" ]]; then
30+
echo "::error::tag (${GITHUB_REF_NAME}) does not match mod version (v${VERSION})"
31+
exit 1
32+
fi
33+
34+
echo "version=$VERSION" >> "$GITHUB_ENV"
35+
36+
- name: Generate update metadata
37+
shell: bash
38+
run: |
39+
set -euo pipefail
40+
41+
ident="$(jq -r '.updates[0].identifier // empty' mod.txt)"
42+
version="$(jq -r '.version' mod.txt)"
43+
repo="$GITHUB_REPOSITORY"
44+
45+
if [[ -z "$ident" ]]; then
46+
echo "has_update_metadata=false" >> "$GITHUB_ENV"
47+
echo "No mod.txt updates[0].identifier configured; skipping update metadata."
48+
exit 0
49+
fi
50+
51+
mkdir -p generated
52+
jq -n \
53+
--arg ident "$ident" \
54+
--arg version "$version" \
55+
--arg download_url "https://github.com/$repo/releases/download/v$version/InlineInput.zip" \
56+
--arg patchnotes_url "https://github.com/$repo/releases/tag/v$version" \
57+
'[{
58+
ident: $ident,
59+
version: $version,
60+
download_url: $download_url,
61+
patchnotes_url: $patchnotes_url
62+
}]' > generated/update_meta.json
63+
64+
echo "has_update_metadata=true" >> "$GITHUB_ENV"
65+
66+
- name: Build SuperBLT zip
67+
shell: bash
68+
run: |
69+
set -euo pipefail
70+
71+
rm -rf package InlineInput.zip
72+
mkdir -p package/InlineInput
73+
cp -R inlineinput.lua mod.txt modules require.lua package/InlineInput/
74+
75+
if [[ "${has_update_metadata}" == "true" ]]; then
76+
cp generated/update_meta.json package/InlineInput/update_meta.json
77+
fi
78+
79+
cd package
80+
zip -r ../InlineInput.zip InlineInput
81+
82+
- name: Get previous tag
83+
id: previous-tag
84+
shell: bash
85+
run: |
86+
set -euo pipefail
87+
88+
git fetch --tags --force
89+
previous_tag="$(git --no-pager tag --sort=creatordate --merged "${GITHUB_REF_NAME}" | grep -v "^${GITHUB_REF_NAME}$" | tail -1 || true)"
90+
echo "previous_tag=$previous_tag" >> "$GITHUB_OUTPUT"
91+
92+
- name: Generate changelog
93+
id: changelog
94+
if: ${{ steps.previous-tag.outputs.previous_tag != '' }}
95+
uses: requarks/changelog-action@v1
96+
with:
97+
token: ${{ github.token }}
98+
fromTag: ${{ github.ref_name }}
99+
toTag: ${{ steps.previous-tag.outputs.previous_tag }}
100+
writeToFile: false
101+
restrictToTypes: feat,fix,perf
102+
useGitmojis: false
103+
includeInvalidCommits: false
104+
105+
- name: Write release notes
106+
env:
107+
CHANGELOG: ${{ steps.changelog.outputs.changes }}
108+
PREVIOUS_TAG: ${{ steps.previous-tag.outputs.previous_tag }}
109+
shell: bash
110+
run: |
111+
set -euo pipefail
112+
113+
printf 'InlineInput %s\n' "$version" > release-notes.md
114+
115+
if [[ -n "$CHANGELOG" ]]; then
116+
printf '\n%s\n' "$CHANGELOG" >> release-notes.md
117+
elif [[ -z "$PREVIOUS_TAG" ]]; then
118+
printf '\nInitial release.\n' >> release-notes.md
119+
else
120+
printf '\nMaintenance release.\n' >> release-notes.md
121+
fi
122+
123+
- name: Upload release asset
124+
env:
125+
GITHUB_TOKEN: ${{ github.token }}
126+
TAG: ${{ github.ref_name }}
127+
shell: bash
128+
run: |
129+
set -euo pipefail
130+
131+
assets=(InlineInput.zip)
132+
if [[ "${has_update_metadata}" == "true" ]]; then
133+
assets+=(generated/update_meta.json)
134+
fi
135+
136+
if gh release view "$TAG" >/dev/null 2>&1; then
137+
gh release edit "$TAG" --notes-file release-notes.md
138+
gh release upload "$TAG" "${assets[@]}" --clobber
139+
else
140+
gh release create "$TAG" "${assets[@]}" \
141+
--title "$TAG" \
142+
--notes-file release-notes.md
143+
fi
144+
145+
- name: Publish update metadata
146+
if: ${{ env.has_update_metadata == 'true' }}
147+
env:
148+
TAG: ${{ github.ref_name }}
149+
shell: bash
150+
run: |
151+
set -euo pipefail
152+
153+
cp generated/update_meta.json update_meta.json
154+
155+
if git diff --quiet -- update_meta.json; then
156+
echo "update_meta.json already matches $TAG"
157+
exit 0
158+
fi
159+
160+
git config user.name "github-actions[bot]"
161+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
162+
git add update_meta.json
163+
git commit -m "chore: update release metadata for $TAG"
164+
git push origin HEAD:main

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Perry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)