Replace Gitea CI workflow with GitHub Actions workflow using gh CLI for release creation. Update auto-updater, changelog fetch, download links, electron-builder publish config, and package.json homepage to point at github.com/bigjakk/Krunker-Civilian-Client.
This commit is contained in:
@@ -1,138 +0,0 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check if version already released
|
||||
id: version-check
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.DEST_GITEA_TOKEN }}
|
||||
run: |
|
||||
VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*"version": *"\([^"]*\)".*/\1/')
|
||||
TAG="v$VERSION"
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
|
||||
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
"https://gitea.crjlab.net/api/v1/repos/bigjakk/krunker-civilian-client/releases/tags/$TAG" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
if [ "$STATUS" = "200" ]; then
|
||||
echo "Release $TAG already exists, skipping build"
|
||||
echo "SKIP=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "No release for $TAG, proceeding with build"
|
||||
echo "SKIP=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install system dependencies
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: |
|
||||
dpkg --add-architecture i386
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends \
|
||||
wine wine32 wine64 \
|
||||
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2t64 \
|
||||
libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \
|
||||
libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 \
|
||||
libcairo2 libasound2t64 libgtk-3-0
|
||||
WINEDEBUG=-all wine wineboot --init || true
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: npm ci
|
||||
|
||||
- name: Build source
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: npm run build
|
||||
|
||||
- name: Build Windows distributables
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
env:
|
||||
WINEDEBUG: "-all"
|
||||
run: npx electron-builder --win -c.electronDist=node_modules/electron/dist-win --publish never
|
||||
|
||||
- name: Build Linux distributables
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: npx electron-builder --linux --publish never
|
||||
|
||||
- name: Report build sizes
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: |
|
||||
echo "=== Build output sizes ==="
|
||||
ls -lh out/*.exe out/*.AppImage out/*.deb 2>/dev/null || true
|
||||
echo "=== Electron dist-win (patched Windows) ==="
|
||||
du -sh node_modules/electron/dist-win/ 2>/dev/null || true
|
||||
echo "=== Electron dist (stock Linux) ==="
|
||||
du -sh node_modules/electron/dist/ 2>/dev/null || true
|
||||
echo "=== Unpacked Windows build ==="
|
||||
du -sh out/win-unpacked/ 2>/dev/null || true
|
||||
du -sh out/win-unpacked/resources/ 2>/dev/null || true
|
||||
du -sh out/win-unpacked/locales/ 2>/dev/null || true
|
||||
|
||||
- name: Create release and upload assets
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.DEST_GITEA_TOKEN }}
|
||||
TAG: ${{ steps.version-check.outputs.TAG }}
|
||||
run: |
|
||||
GITEA_BASE="https://gitea.crjlab.net"
|
||||
REPO="bigjakk/krunker-civilian-client"
|
||||
|
||||
# Create tag
|
||||
curl -s -X POST "$GITEA_BASE/api/v1/repos/$REPO/tags" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"$TAG\", \"message\": \"$TAG\", \"target\": \"$GITHUB_SHA\"}"
|
||||
|
||||
# Create release
|
||||
RESPONSE=$(curl -s -X POST "$GITEA_BASE/api/v1/repos/$REPO/releases" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG\",
|
||||
\"name\": \"$TAG\",
|
||||
\"body\": \"Automated build for $TAG\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}")
|
||||
|
||||
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||
echo "Created release ID: $RELEASE_ID"
|
||||
|
||||
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||
echo "Failed to create release:"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Upload all built artifacts
|
||||
for file in out/*.exe out/*.AppImage out/*.deb; do
|
||||
[ -f "$file" ] || continue
|
||||
FILENAME=$(basename "$file")
|
||||
SAFE_NAME=$(echo "$FILENAME" | tr ' ' '_')
|
||||
echo "Uploading: $SAFE_NAME ($(du -h "$file" | cut -f1))"
|
||||
|
||||
curl -s -X POST \
|
||||
"$GITEA_BASE/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$SAFE_NAME" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-F "attachment=@$file" \
|
||||
| jq -r '" -> \(.name) (\(.size) bytes)"'
|
||||
done
|
||||
|
||||
echo "All assets uploaded"
|
||||
@@ -0,0 +1,95 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check if version already released
|
||||
id: version-check
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*"version": *"\([^"]*\)".*/\1/')
|
||||
TAG="v$VERSION"
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
|
||||
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG")
|
||||
|
||||
if [ "$STATUS" = "200" ]; then
|
||||
echo "Release $TAG already exists, skipping build"
|
||||
echo "SKIP=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "No release for $TAG, proceeding with build"
|
||||
echo "SKIP=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install system dependencies
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
wine wine32 wine64 \
|
||||
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2t64 \
|
||||
libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \
|
||||
libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 \
|
||||
libcairo2 libasound2t64 libgtk-3-0
|
||||
WINEDEBUG=-all wine wineboot --init || true
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: npm ci
|
||||
|
||||
- name: Build source
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: npm run build
|
||||
|
||||
- name: Build Windows distributables
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
env:
|
||||
WINEDEBUG: "-all"
|
||||
run: npx electron-builder --win -c.electronDist=node_modules/electron/dist-win --publish never
|
||||
|
||||
- name: Build Linux distributables
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
run: npx electron-builder --linux --publish never
|
||||
|
||||
- name: Create release and upload assets
|
||||
if: steps.version-check.outputs.SKIP == 'false'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ steps.version-check.outputs.TAG }}
|
||||
run: |
|
||||
# Create release
|
||||
gh release create "$TAG" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--title "$TAG" \
|
||||
--notes "Automated build for $TAG" \
|
||||
--latest
|
||||
|
||||
# Upload all built artifacts
|
||||
for file in out/*.exe out/*.AppImage out/*.deb; do
|
||||
[ -f "$file" ] || continue
|
||||
FILENAME=$(basename "$file")
|
||||
echo "Uploading: $FILENAME ($(du -h "$file" | cut -f1))"
|
||||
gh release upload "$TAG" "$file" --repo "${{ github.repository }}"
|
||||
done
|
||||
|
||||
echo "All assets uploaded"
|
||||
@@ -3,8 +3,8 @@
|
||||
> a high-performance krunker client with unlimited FPS, built on a custom-patched Electron
|
||||
|
||||
**Download:**
|
||||
[Windows (x64)](https://gitea.crjlab.net/bigjakk/Krunker-Civilian-Client/releases/latest) -
|
||||
[Linux (AppImage)](https://gitea.crjlab.net/bigjakk/Krunker-Civilian-Client/releases/latest)
|
||||
[Windows (x64)](https://github.com/bigjakk/Krunker-Civilian-Client/releases/latest) -
|
||||
[Linux (AppImage)](https://github.com/bigjakk/Krunker-Civilian-Client/releases/latest)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -75,7 +75,7 @@ For details on the patch and build instructions, see [Electron-Websocket-Fix](ht
|
||||
1. Install [git](https://git-scm.com/downloads), [Node.js](https://nodejs.org/), and npm
|
||||
2. Clone and install:
|
||||
```bash
|
||||
git clone https://gitea.crjlab.net/bigjakk/Krunker-Civilian-Client.git
|
||||
git clone https://github.com/bigjakk/Krunker-Civilian-Client.git
|
||||
cd Krunker-Civilian-Client
|
||||
npm install
|
||||
```
|
||||
|
||||
@@ -67,5 +67,5 @@ linux:
|
||||
|
||||
publish:
|
||||
provider: github
|
||||
owner: krunker-civilian
|
||||
repo: krunker-civilian-client
|
||||
owner: bigjakk
|
||||
repo: Krunker-Civilian-Client
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"version": "0.5.6",
|
||||
"description": "Cross-platform Krunker game client",
|
||||
"main": "dist/main/index.js",
|
||||
"homepage": "https://gitea.crjlab.net/bigjakk/krunker-civilian-client",
|
||||
"homepage": "https://github.com/bigjakk/Krunker-Civilian-Client",
|
||||
"author": "Krunker Civilian Client <krunker@crjlab.net>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
+1
-1
@@ -683,7 +683,7 @@ async function launchApp(): Promise<void> {
|
||||
const tag = version.startsWith('v') ? version : `v${version}`;
|
||||
try {
|
||||
const data = await new Promise<string>((resolve, reject) => {
|
||||
httpsGet(`https://gitea.crjlab.net/api/v1/repos/bigjakk/Krunker-Civilian-Client/releases/tags/${tag}`, (res) => {
|
||||
httpsGet(`https://api.github.com/repos/bigjakk/Krunker-Civilian-Client/releases/tags/${tag}`, { headers: { 'User-Agent': 'KCC' } }, (res) => {
|
||||
let body = '';
|
||||
res.on('data', (chunk: string) => { body += chunk; });
|
||||
res.on('end', () => resolve(body));
|
||||
|
||||
+2
-4
@@ -13,11 +13,9 @@ export interface UpdateInfo {
|
||||
export type ProgressCallback = (percent: number) => void;
|
||||
|
||||
const UPDATE_CONFIG = {
|
||||
// Gitea provider
|
||||
checkUrl: 'https://gitea.crjlab.net/api/v1/repos/bigjakk/Krunker-Civilian-Client/releases/latest',
|
||||
checkUrl: 'https://api.github.com/repos/bigjakk/Krunker-Civilian-Client/releases/latest',
|
||||
assetPattern: /Setup\.exe$/i,
|
||||
// Allowed hosts for update check and download (including redirects)
|
||||
allowedHosts: ['gitea.crjlab.net'],
|
||||
allowedHosts: ['github.com', 'api.github.com', 'objects.githubusercontent.com'],
|
||||
};
|
||||
|
||||
const CHECK_TIMEOUT_MS = 10000;
|
||||
|
||||
Reference in New Issue
Block a user