add more linux pkgs, create auto-release and pre-release feature for Github Actions

This commit is contained in:
Fazri Gading
2026-01-21 06:41:25 +08:00
committed by GitHub
parent b05aeef66d
commit 048f2040f1

View File

@@ -3,7 +3,7 @@ name: Build and Release
on: on:
push: push:
branches: branches:
- main - release
tags: tags:
- 'v*' - 'v*'
workflow_dispatch: workflow_dispatch:
@@ -13,12 +13,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install dependencies for Pacman build
run: |
sudo apt-get update
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'
@@ -31,6 +25,9 @@ jobs:
path: | path: |
dist/*.AppImage dist/*.AppImage
dist/*.deb dist/*.deb
dist/*.snap
dist/*.rpm
dist/*.pacman
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
@@ -69,7 +66,10 @@ jobs:
release: release:
needs: [build-linux, build-windows, build-macos] needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' if: |
startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/release' ||
github.event_name == 'workflow_dispatch'
permissions: permissions:
contents: write contents: write
@@ -83,17 +83,22 @@ jobs:
- name: Display structure of downloaded files - name: Display structure of downloaded files
run: ls -R artifacts 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 - name: Create Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('manual-{0}', github.sha) }} # If it's a tag, use the tag.
name: ${{ github.ref_type == 'tag' && github.ref_name || format('Manual build {0}', github.sha) }} tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}-beta.{1}', steps.pkg_version.outputs.VERSION, github.run_number) }}
# If it's the 'release' branch, use 'v2.0.2-beta.run42'
name: ${{ github.ref_type == 'tag' && github.ref_name || format('Hytale-F2P v{0} (Beta Build {1})', steps.pkg_version.outputs.VERSION, github.run_number) }}
files: | files: |
artifacts/linux-builds/**/* artifacts/linux-builds/**/*
artifacts/windows-builds/**/* artifacts/windows-builds/**/*
artifacts/macos-builds/**/* artifacts/macos-builds/**/*
generate_release_notes: true generate_release_notes: true
draft: false draft: true
prerelease: false # DYNAMIC FLAGS: Mark as pre-release ONLY IF it's NOT a tag (meaning it's a branch push)
prerelease: ${{ github.ref_type != 'tag' }}