Skip to content

Commit 5e5f1ae

Browse files
committed
WIP
1 parent 9a6f742 commit 5e5f1ae

7 files changed

Lines changed: 221 additions & 85 deletions

File tree

.github/workflows/release.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- '*.*.*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
env:
14+
ADDON_NAME: 'MemoryGarbageCollector'
15+
16+
jobs:
17+
release:
18+
name: "release"
19+
runs-on: ubuntu-latest
20+
permissions: write-all
21+
steps:
22+
- name: Check out repository
23+
uses: actions/checkout@v4
24+
25+
- name: Get addon variables
26+
run: |
27+
version=$(echo "${{ github.ref_name }}" | sed -e 's/[^[:alnum:]._-]/-/g')
28+
29+
echo "ADDON_VERSION=$version" >> $GITHUB_OUTPUT
30+
echo "ZIP_NAME=${{ env.ADDON_NAME }}-$version.zip" >> $GITHUB_OUTPUT
31+
32+
33+
- name: Replace placeholders in addon files
34+
run: |
35+
# Replace text version
36+
sed -i "s/version = \"dev\"/version = \"${{ env.ADDON_VERSION }}\"/g" ${{ env.ADDON_NAME }}.lua
37+
sed -i "s/## Version: dev/## Version: ${{ env.ADDON_VERSION }}/g" ${{ env.ADDON_NAME }}.addon
38+
39+
# Replace numeric version only for tag build
40+
if [ "${{ github.ref_type }}" == "tag" ]; then
41+
42+
# Split major.minor.patch
43+
IFS='.' read -r MAJOR MINOR PATCH <<< "${{ github.ref_name }}"
44+
45+
# Pad every part to 3 digit
46+
MAJOR_PAD=$(printf "%03d" "$MAJOR")
47+
MINOR_PAD=$(printf "%03d" "$MINOR")
48+
PATCH_PAD=$(printf "%03d" "$PATCH")
49+
50+
VERSION_INT=$((10#$MAJOR_PAD$MINOR_PAD$PATCH_PAD))
51+
52+
sed -i "s/## AddOnVersion: 99999999/## AddOnVersion: $VERSION_INT/g" ${{ env.ADDON_NAME }}.addon
53+
fi
54+
55+
- name: Create ZIP archive
56+
run: |
57+
zip -r --quiet "$(pwd)/${{ env.ZIP_NAME }}" "${{ env.ADDON_NAME }}"
58+
59+
- name: Extract latest changelog entry
60+
run: |
61+
awk '/^## / { if (!found) { found=1; print; next } else { exit } } found' CHANGELOG.md > latest_changes.md
62+
cat latest_changes.md
63+
64+
- name: Create GitHub Release
65+
uses: ncipollo/release-action@v1
66+
if: ${{ github.ref_type == 'tag' }}
67+
with:
68+
name: "${{ env.ADDON_VERSION }}"
69+
commit: ${{ github.ref }}
70+
tag: "${{ env.ADDON_VERSION }}"
71+
artifacts: "${{ env.ZIP_NAME }}"
72+
artifactContentType: application/zip
73+
bodyFile: latest_changes.md
74+
allowUpdates: true
75+
makeLatest: true
76+
77+
- name: Upload artifact
78+
uses: actions/upload-artifact@v4
79+
if: ${{ github.ref_type != 'tag' }}
80+
with:
81+
path: ${{ env.ZIP_NAME }}
82+
83+
retention-days: 3
84+
# - name: Send to ESOUI
85+
# env:
86+
# ESOUI_API_KEY: ${{ secrets.ESOUI_API_KEY }}
87+
# ADDON_ID: 2311
88+
# run: |
89+
# curl -X POST \
90+
# -H "x-api-token: $ESOUI_API_KEY" \
91+
# -F "id=${ADDON_ID}" \
92+
# -F "version=${{ env.ADDON_VERSION }}" \
93+
# -F "updatefile=@${{ env.ZIP_NAME }}" \
94+
# -F "changelog=$(cat CHANGELOG.md)" \
95+
# https://api.esoui.com/addons/update

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ luac.out
3939
*.x86_64
4040
*.hex
4141

42+
.idea/*

CHANGELOG.md

Whitespace-only changes.
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## Title: Memory Garbage Collector
2-
## Version: 1.0.2
3-
## APIVersion: 101041
2+
## Version: dev
43
## Author: @BioNik12 [EU]
5-
6-
## DependsOn: LibAddonMenu-2.0
4+
## APIVersion: 101044 101045
5+
## AddOnVersion: 99999999
6+
## SavedVariables: MemoryGarbageCollectorSV
7+
## DependsOn: LibAddonMenu-2.0>=32
78
## OptionalDependsOn: LibChatMessage
8-
## SavedVariables: MemoryGarbageCollectorVars
99

1010
## This Add-on is not created by, affiliated with or sponsored by ZeniMax Media
1111
## Inc. or its affiliates. The Elder Scrolls® and related logos are registered
@@ -17,9 +17,9 @@
1717
##
1818
## You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
1919

20-
# Main
21-
i18n\en.lua
22-
i18n\$(language).lua
20+
# Localization
21+
lang\en.lua
22+
lang\$(language).lua
2323

24-
#Main
25-
MemoryGarbageCollector.lua
24+
# Main
25+
MemoryGarbageCollector.lua

0 commit comments

Comments
 (0)