mirror of
https://git.sanhost.net/sanasol/hytale-f2p
synced 2026-02-27 16:51:46 -03:00
Compare commits
1 Commits
v2.3.0-tes
...
v2.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5b44341f1 |
226
.github/workflows/release.yml
vendored
226
.github/workflows/release.yml
vendored
@@ -6,117 +6,201 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
# Domain for small API calls (goes through Cloudflare - fine for <100MB)
|
|
||||||
FORGEJO_API: https://git.sanhost.net/api/v1
|
|
||||||
# Direct upload URL (bypasses Cloudflare for large files) - set in repo secrets
|
|
||||||
FORGEJO_UPLOAD: ${{ secrets.FORGEJO_UPLOAD_URL }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Create Draft Release
|
|
||||||
run: |
|
|
||||||
curl -s -X POST "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases" \
|
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\":\"${{ github.ref_name }}\",\"name\":\"${{ github.ref_name }}\",\"body\":\"Release ${{ github.ref_name }}\",\"draft\":true,\"prerelease\":false}" \
|
|
||||||
-o release.json
|
|
||||||
cat release.json
|
|
||||||
echo "RELEASE_ID=$(cat release.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
needs: [create-release]
|
runs-on: windows-latest
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Wine for cross-compilation
|
|
||||||
run: |
|
|
||||||
sudo dpkg --add-architecture i386
|
|
||||||
sudo mkdir -pm755 /etc/apt/keyrings
|
|
||||||
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
|
|
||||||
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -cs)/winehq-$(lsb_release -cs).sources
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y --install-recommends winehq-stable
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
- name: Build Windows Packages
|
- name: Create Virtual .env File
|
||||||
run: npx electron-builder --win --publish never --config.npmRebuild=false
|
# Because main.js needed physical env, we need to create virtual one to store it
|
||||||
|
|
||||||
- name: Upload to Release
|
|
||||||
run: |
|
run: |
|
||||||
RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
|
$env_content = @"
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
HF2P_PROXY_URL=${{ secrets.HF2P_PROXY_URL }}
|
||||||
for file in dist/*.exe dist/*.exe.blockmap dist/latest.yml; do
|
HF2P_SECRET_KEY=${{ secrets.HF2P_SECRET_KEY }}
|
||||||
[ -f "$file" ] || continue
|
"@
|
||||||
echo "Uploading $file..."
|
Set-Content -Path .env -Value $env_content
|
||||||
curl -s --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
|
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
- name: Build Windows Packages
|
||||||
-F "attachment=@${file}" || echo "Failed to upload $file"
|
run: npx electron-builder --win --publish never
|
||||||
done
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows-builds
|
||||||
|
path: |
|
||||||
|
dist/*.exe
|
||||||
|
dist/*.exe.blockmap
|
||||||
|
dist/latest.yml
|
||||||
|
|
||||||
build-macos:
|
build-macos:
|
||||||
needs: [create-release]
|
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
|
- name: Create Virtual .env File
|
||||||
|
run: |
|
||||||
|
cat << EOF > .env
|
||||||
|
HF2P_PROXY_URL=${{ secrets.HF2P_PROXY_URL }}
|
||||||
|
HF2P_SECRET_KEY=${{ secrets.HF2P_SECRET_KEY }}
|
||||||
|
EOF
|
||||||
|
|
||||||
- name: Build macOS Packages
|
- name: Build macOS Packages
|
||||||
env:
|
env:
|
||||||
|
# Code signing
|
||||||
CSC_LINK: ${{ secrets.CSC_LINK }}
|
CSC_LINK: ${{ secrets.CSC_LINK }}
|
||||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||||
|
# Notarization
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
run: npx electron-builder --mac --publish never
|
run: npx electron-builder --mac --publish never
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
- name: Upload to Release
|
with:
|
||||||
run: |
|
name: macos-builds
|
||||||
RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
|
path: |
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
dist/*.dmg
|
||||||
for file in dist/*.dmg dist/*.zip dist/*.blockmap dist/latest-mac.yml; do
|
dist/*.zip
|
||||||
[ -f "$file" ] || continue
|
dist/*.blockmap
|
||||||
echo "Uploading $file..."
|
dist/latest-mac.yml
|
||||||
curl -s --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
|
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
|
||||||
-F "attachment=@${file}" || echo "Failed to upload $file"
|
|
||||||
done
|
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [create-release]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libarchive-tools rpm
|
sudo apt-get install -y libarchive-tools
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
- name: Build Linux Packages
|
- name: Create Virtual .env File
|
||||||
run: npx electron-builder --linux AppImage deb rpm pacman --publish never
|
|
||||||
|
|
||||||
- name: Upload to Release
|
|
||||||
run: |
|
run: |
|
||||||
RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
|
cat << EOF > .env
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
HF2P_PROXY_URL=${{ secrets.HF2P_PROXY_URL }}
|
||||||
for file in dist/*.AppImage dist/*.AppImage.blockmap dist/*.deb dist/*.rpm dist/*.pacman dist/latest-linux.yml; do
|
HF2P_SECRET_KEY=${{ secrets.HF2P_SECRET_KEY }}
|
||||||
[ -f "$file" ] || continue
|
EOF
|
||||||
echo "Uploading $file..."
|
|
||||||
curl -s --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
|
- name: Build Linux Packages
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
run: |
|
||||||
-F "attachment=@${file}" || echo "Failed to upload $file"
|
npx electron-builder --linux AppImage deb rpm --publish never
|
||||||
done
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux-builds
|
||||||
|
path: |
|
||||||
|
dist/*.AppImage
|
||||||
|
dist/*.AppImage.blockmap
|
||||||
|
dist/*.deb
|
||||||
|
dist/*.rpm
|
||||||
|
dist/latest-linux.yml
|
||||||
|
|
||||||
|
build-arch:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: archlinux:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install base packages
|
||||||
|
run: |
|
||||||
|
pacman -Syu --noconfirm
|
||||||
|
pacman -S --noconfirm \
|
||||||
|
base-devel \
|
||||||
|
git \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
rpm-tools \
|
||||||
|
libxcrypt-compat
|
||||||
|
|
||||||
|
- name: Create build user
|
||||||
|
run: |
|
||||||
|
useradd -m builder
|
||||||
|
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
|
|
||||||
|
- name: Fix Permissions
|
||||||
|
run: chown -R builder:builder .
|
||||||
|
|
||||||
|
- name: Build Arch Package
|
||||||
|
run: |
|
||||||
|
sudo -u builder bash << 'EOF'
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cat << EOP > .env
|
||||||
|
HF2P_PROXY_URL=${{ secrets.HF2P_PROXY_URL }}
|
||||||
|
HF2P_SECRET_KEY=${{ secrets.HF2P_SECRET_KEY }}
|
||||||
|
EOP
|
||||||
|
|
||||||
|
makepkg --printsrcinfo > .SRCINFO
|
||||||
|
makepkg -s --noconfirm
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Fix permissions for upload
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
sudo chown -R $(id -u):$(id -g) .
|
||||||
|
|
||||||
|
- name: Upload Arch Package
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: arch-package
|
||||||
|
path: |
|
||||||
|
*.pkg.tar.zst
|
||||||
|
.SRCINFO
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: [build-windows, build-macos, build-linux, build-arch]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: |
|
||||||
|
startsWith(github.ref, 'refs/tags/v') ||
|
||||||
|
github.ref == 'refs/heads/main' ||
|
||||||
|
github.event_name == 'workflow_dispatch'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Display structure of downloaded files
|
||||||
|
run: ls -R artifacts
|
||||||
|
|
||||||
|
- name: Get version from package.json
|
||||||
|
id: pkg_version
|
||||||
|
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
files: |
|
||||||
|
artifacts/arch-package/*.pkg.tar.zst
|
||||||
|
artifacts/arch-package/.SRCINFO
|
||||||
|
artifacts/linux-builds/**/*
|
||||||
|
artifacts/windows-builds/**/*
|
||||||
|
artifacts/macos-builds/**/*
|
||||||
|
generate_release_notes: true
|
||||||
|
draft: true
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user