Skip to content

Commit 7fff162

Browse files
Merge branch 'Acode-Foundation:main' into main
2 parents e30a8b3 + 8da3049 commit 7fff162

File tree

99 files changed

+13399
-2134
lines changed

Some content is hidden

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

99 files changed

+13399
-2134
lines changed
Lines changed: 109 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,126 @@
11
name: community-release-notifier
2+
23
on:
34
release:
45
types: [ released ]
56
workflow_call:
67
inputs:
7-
tag_name:
8-
required: true
9-
description: "Release tag_name"
10-
type: 'string'
11-
url:
12-
required: true
13-
description: "release URL"
14-
type: 'string'
15-
body:
16-
required: true
17-
description: "Release Body"
18-
type: 'string'
19-
default: ''
8+
tag_name:
9+
required: true
10+
description: "Release tag_name"
11+
type: 'string'
12+
url:
13+
required: true
14+
description: "release URL"
15+
type: 'string'
16+
body:
17+
required: true
18+
description: "Release Body"
19+
type: 'string'
20+
default: ''
2021
secrets:
2122
DISCORD_WEBHOOK_RELEASE_NOTES:
2223
description: 'Discord Webhook for Notifying Releases to Discord'
2324
required: true
25+
TELEGRAM_BOT_TOKEN:
26+
description: 'Telegram Bot Token'
27+
required: true
28+
TELEGRAM_CHAT_ID:
29+
description: 'Telegram Chat ID (group/channel/supergroup)'
30+
required: true
31+
TELEGRAM_MESSAGE_THREAD_ID:
32+
description: 'Topic / message_thread_id for Telegram forum/topic'
33+
required: true
2434

2535
jobs:
26-
discord-release:
36+
notify:
2737
if: github.repository_owner == 'Acode-Foundation'
2838
runs-on: ubuntu-latest
2939
steps:
30-
- name: Get Release Content
31-
id: get-release-content
32-
uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757 # v1.4.1
33-
with:
34-
maxLength: 2000
35-
stringToTruncate: |
36-
📢 Acode [${{ github.event.release.tag_name || inputs.tag_name }}](<${{ github.event.release.url || inputs.url }}>) was just Released 🎉!
40+
- name: Prepare release variables
41+
id: vars
42+
env:
43+
INPUT_TAG: ${{ github.event.release.tag_name || inputs.tag_name }}
44+
INPUT_URL: ${{ github.event.release.url || inputs.url }}
45+
INPUT_BODY: ${{ github.event.release.body || inputs.body }}
46+
run: |
47+
TAG="$INPUT_TAG"
48+
URL="$INPUT_URL"
49+
50+
# Generate a random delimiter (hex string, safe and collision-resistant)
51+
DELIMITER=$(openssl rand -hex 16 || head -c 16 /dev/urandom | xxd -p -c 16)
3752
38-
${{ github.event.release.body || inputs.body }}
53+
# Escape problematic characters for MarkdownV2 (very conservative escaping)
54+
# We escape: _ * [ ] ( ) ~ ` > # + - = | { } . ! \
55+
BODY_SAFE=$(printf '%s' "$INPUT_BODY" | \
56+
sed 's/[_*[\]()~`>#+=|{}.!\\-]/\\&/g')
57+
TAG_SAFE=$(printf '%s' "$TAG" | sed 's/[_*[\]()~`>#+=|{}.!\\-]/\\&/g')
58+
59+
if [[ "$TAG" == *"-nightly"* ]]; then
60+
SUFFIX=" \(Nightly Release\)"
61+
SUFFIXPLAIN=" (Nightly Release)"
62+
else
63+
SUFFIX=""
64+
SUFFIXPLAIN=""
65+
fi
66+
67+
# Announcement line — also escape for safety
68+
ANNOUNCE_SAFE="📢 Acode [$TAG_SAFE]($URL) was just Released 🎉${SUFFIX}\\!"
69+
70+
echo "announce=$ANNOUNCE_SAFE" >> $GITHUB_OUTPUT
71+
{
72+
echo "body_safe<<$DELIMITER"
73+
printf '%s\n' "$BODY_SAFE"
74+
echo "$DELIMITER"
75+
} >> $GITHUB_OUTPUT
76+
77+
# Plain (MD) Announcement for Discord
78+
ANNOUNCE_PLAIN="📢 Acode [$TAG](<$URL>) was just Released 🎉${SUFFIXPLAIN}!"
79+
echo "announce_plain=$ANNOUNCE_PLAIN" >> $GITHUB_OUTPUT
80+
{
81+
echo "body_plain<<$DELIMITER"
82+
printf '%s\n' "$INPUT_BODY"
83+
echo "$DELIMITER"
84+
} >> $GITHUB_OUTPUT
85+
86+
# ────────────────────────────────────────────────
87+
# Truncate for Discord
88+
# ────────────────────────────────────────────────
89+
- name: Truncate message for Discord
90+
id: truncate-discord
91+
uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757 # v1.4.1
92+
with:
93+
maxLength: 2000
94+
stringToTruncate: |
95+
${{ steps.vars.outputs.announce_plain }}
96+
97+
${{ steps.vars.outputs.body_plain }}
98+
99+
# ────────────────────────────────────────────────
100+
# Discord notification
101+
# ────────────────────────────────────────────────
102+
- name: Discord Webhook (Publishing)
103+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645 # v7.0.0
104+
with:
105+
webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
106+
content: ${{ steps.truncate-discord.outputs.string }}
107+
flags: 4 # 1 << 2 - SUPPRESS_EMBEDS!
108+
109+
# ────────────────────────────────────────────────
110+
# Telegram notification — MarkdownV2 + no link preview
111+
# ────────────────────────────────────────────────
112+
- name: Send to Telegram
113+
#if: ${{ secrets.TELEGRAM_BOT_TOKEN != '' && secrets.TELEGRAM_CHAT_ID != '' && secrets.TELEGRAM_MESSAGE_THREAD_ID != '' }}
114+
uses: Salmansha08/telegram-github-action@17c9ce6b4210d2659dca29d34028b02fa29d70ad # or newer tag if available
115+
with:
116+
to: ${{ secrets.TELEGRAM_CHAT_ID }}
117+
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
118+
message: |
119+
${{ steps.vars.outputs.announce }}
39120
40-
- name: Discord Webhook Action (Publishing)
41-
uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164 # v5.3.0
42-
with:
43-
webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
44-
content: ${{ steps.get-release-content.outputs.string }}
121+
${{ steps.vars.outputs.body_safe }}
122+
format: markdown
123+
disable_web_page_preview: true
124+
# Only needed for topic-enabled supergroups/channels
125+
message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
126+
continue-on-error: true

.github/workflows/nightly-build.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,25 @@
9595
echo "should not skip tags, releases: ${{ ! inputs.skip_tagging_and_releases }}" >> $GITHUB_STEP_SUMMARY
9696
9797
- name: Checkout Repository
98-
uses: actions/checkout@v4
98+
uses: actions/checkout@v6
9999
with:
100100
fetch-depth: 0 # Required for tags
101101
# persists credentials locally if tagging and releases are not skipped.
102102
persist-credentials: ${{ ! inputs.skip_tagging_and_releases }}
103103
ref: ${{ (inputs.is_PR && inputs.PR_NUMBER) && github.event.pull_request.head.sha || '' }}
104104

105105
- name: Set up Java 21
106-
uses: actions/setup-java@v4
106+
uses: actions/setup-java@v5
107107
with:
108108
distribution: 'temurin'
109109
java-version: '21'
110110
cache: ${{ (!(inputs.is_PR && inputs.PR_NUMBER) && github.ref == 'refs/heads/main' && 'gradle') || '' }}
111111

112112
- name: Set up Node.js
113-
uses: actions/setup-node@v4
113+
uses: actions/setup-node@v6
114114
with:
115115
node-version: 'lts/*' # or '18.x' for latest stable
116+
cache: ${{ (!(inputs.is_PR && inputs.PR_NUMBER) && github.ref == 'refs/heads/main' && 'npm') || '' }}
116117

117118
- name: Add keystore and build.json from secrets
118119
run: |
@@ -175,7 +176,7 @@
175176
echo "VERSION: $UPDATED_VERSION" >> $GITHUB_STEP_SUMMARY
176177
177178
- name: Upload APK Artifact
178-
uses: actions/upload-artifact@v4
179+
uses: actions/upload-artifact@v6
179180
with:
180181
name: app-debug-${{ env.GIT_COMMIT }}
181182
path: /tmp/app-debug-normal.apk
@@ -188,7 +189,7 @@
188189
mv platforms/android/app/build/outputs/apk/debug/app-debug.apk /tmp/app-debug-fdroid.apk
189190
190191
- name: Upload APK Artifact
191-
uses: actions/upload-artifact@v4
192+
uses: actions/upload-artifact@v6
192193
if: ${{ !inputs.is_PR }}
193194
with:
194195
name: app-debug-fdroid-${{ env.GIT_COMMIT }}
@@ -283,3 +284,6 @@
283284
body: ${{ needs.build.outputs.RELEASE_NOTES }}
284285
secrets:
285286
DISCORD_WEBHOOK_RELEASE_NOTES: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
287+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
288+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
289+
TELEGRAM_MESSAGE_THREAD_ID: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}

.github/workflows/on-demand-preview-releases-PR.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
steps:
3636
- name: Checkout code
37-
uses: actions/checkout@v4
37+
uses: actions/checkout@v6
3838
with:
3939
clean: false
4040
fetch-depth: 0

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,45 @@ refactor: simplify file loading logic
166166
pnpm run lang update # Update translations
167167
```
168168

169+
## ℹ️ Adding New Icons (to the existing font family)
170+
> [!NOTE]
171+
> Acode uses SVG and converts them into a font family, to be used inside the editor and generally for plugin devs.
172+
>
173+
> **Plugin-specific icons SHOULD NOT be added into the editor. Only generally helpful icons SHOULD BE added**
174+
175+
Many font editing software and web-based tools exist for this purpose. Some of them are listed below.
176+
177+
| Name | Platform |
178+
|------|----------|
179+
| https://icomoon.io/ | Free (Web-Based, PWA-supported, Offline-supported) |
180+
| https://fontforge.org/ | Open-Source (Linux, Mac, Windows) |
181+
182+
### Steps in Icomoon to add new Icons
183+
184+
1. Download the `icons.ttf` file from https://github.com/Acode-Foundation/Acode/tree/main/src/res/icons
185+
2. Go to https://icomoon.io/ > Start a new Project
186+
3. Import the `icons.ttf` downloaded (in step 1)
187+
4. All icons will be displayed after importing.
188+
5. Import the SVG icon created/downloaded to be added to the Font Family.
189+
6. On the right side, press **enable Show Characters** to view the Unicode character for that icon.
190+
7. Copy the newly added icon's Unicode character (required for later steps)
191+
8. Repeat Step 5 and Step 7 until all needed new icons are added.
192+
9. Press the export icon from the top left-hand side.
193+
10. Add **Font** in the formats section, expand the **Font**, enter **code-editor-icon** as the font-family for `icons.ttf` file.
194+
11. Press the download button, and a zip file will be downloaded.
195+
196+
### Adding the Unicode characters to style.css
197+
198+
1. Open the `style.css` file present at https://github.com/Acode-Foundation/Acode/tree/main/src/res/icons
199+
2. Add a new class called `.icon.icon-name:before` e.g ```.icon.all_inclusive:before { content: "\ea18"; }```
200+
3. `content` (i.e., `ea18` -> `\ea18`) property's value is the Unicode Character copied after importing the icon in the font family.
201+
4. Save the `style.css` file.
202+
5. Extract the downloaded zip file; navigate to the `fonts` folder inside it.
203+
6. Rename `code-editor-icon.ttf` to `icons.ttf`.
204+
7. Copy & paste the renamed `icons.ttf` into https://github.com/Acode-Foundation/Acode/tree/main/src/res/icons
205+
8. Commit the changes **ON A NEW branch** (by following: [Commit Messages guide](#commit-messages))
206+
5. commit the changes **ON A NEW branch** (by following: [Commit Messages guide](#commit-messages))
207+
169208
## 🔌 Plugin Development
170209

171210
To create plugins for Acode:

0 commit comments

Comments
 (0)