mirror of
https://git.sanhost.net/sanasol/hytale-f2p
synced 2026-02-26 05:41:48 -03:00
ci: fix Forgejo Actions compatibility
- Remove upload-artifact/download-artifact (not supported on Forgejo) - Each build job uploads directly to release via API - Add `rpm` package to Linux build dependencies - Remove separate release job, replaced by create-release + per-job upload - Remove arch build job entirely Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
164
.github/workflows/release.yml
vendored
164
.github/workflows/release.yml
vendored
@@ -7,7 +7,22 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
create-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Create Draft Release
|
||||||
|
run: |
|
||||||
|
curl -s -X POST "https://git.sanhost.net/api/v1/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: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -22,149 +37,80 @@ jobs:
|
|||||||
- 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: Build Windows Packages
|
||||||
run: npx electron-builder --win --publish never
|
run: npx electron-builder --win --publish never
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
- name: Upload to Release
|
||||||
name: windows-builds
|
run: |
|
||||||
path: |
|
RELEASE_ID=$(curl -s "https://git.sanhost.net/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
|
||||||
dist/*.exe
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
||||||
dist/*.exe.blockmap
|
for file in dist/*.exe dist/*.exe.blockmap dist/latest.yml; do
|
||||||
dist/latest.yml
|
[ -f "$file" ] || continue
|
||||||
|
echo "Uploading $file..."
|
||||||
|
curl -s -X POST "https://git.sanhost.net/api/v1/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-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: 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
|
|
||||||
with:
|
- name: Upload to Release
|
||||||
name: macos-builds
|
run: |
|
||||||
path: |
|
RELEASE_ID=$(curl -s "https://git.sanhost.net/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
|
||||||
dist/*.dmg
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
||||||
dist/*.zip
|
for file in dist/*.dmg dist/*.zip dist/*.blockmap dist/latest-mac.yml; do
|
||||||
dist/*.blockmap
|
[ -f "$file" ] || continue
|
||||||
dist/latest-mac.yml
|
echo "Uploading $file..."
|
||||||
|
curl -s -X POST "https://git.sanhost.net/api/v1/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:
|
||||||
|
needs: [create-release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
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
|
sudo apt-get install -y libarchive-tools rpm
|
||||||
|
|
||||||
- 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: Build Linux Packages
|
||||||
|
run: npx electron-builder --linux AppImage deb rpm --publish never
|
||||||
|
|
||||||
|
- name: Upload to Release
|
||||||
run: |
|
run: |
|
||||||
npx electron-builder --linux AppImage deb rpm --publish never
|
RELEASE_ID=$(curl -s "https://git.sanhost.net/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
|
||||||
- uses: actions/upload-artifact@v4
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
||||||
with:
|
for file in dist/*.AppImage dist/*.AppImage.blockmap dist/*.deb dist/*.rpm dist/latest-linux.yml; do
|
||||||
name: linux-builds
|
[ -f "$file" ] || continue
|
||||||
path: |
|
echo "Uploading $file..."
|
||||||
dist/*.AppImage
|
curl -s -X POST "https://git.sanhost.net/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
|
||||||
dist/*.AppImage.blockmap
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||||
dist/*.deb
|
-F "attachment=@${file}" || echo "Failed to upload $file"
|
||||||
dist/*.rpm
|
done
|
||||||
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
|
|
||||||
# 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
|
|
||||||
# include-hidden-files: true
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: [build-windows, build-macos, build-linux]
|
|
||||||
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: actions/forgejo-release@v2
|
|
||||||
with:
|
|
||||||
tag: ${{ github.ref_name }}
|
|
||||||
direction: upload
|
|
||||||
url: https://git.sanhost.net
|
|
||||||
token: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
release-dir: artifacts
|
|
||||||
release-notes: "Release ${{ github.ref_name }}"
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user