Skip to content

Commit

Permalink
update:workflows more release support
Browse files Browse the repository at this point in the history
added:release.yml and issue-translator.yml
  • Loading branch information
xengine-qyt committed Dec 31, 2024
1 parent 94d98bb commit fd761f5
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 103 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/issue-translator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Issue Translator
on:
issue_comment:
types: [created]
issues:
types: [opened]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: usthe/issues-translate-action@v2.7
with:
IS_MODIFY_TITLE: false
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically.
67 changes: 0 additions & 67 deletions .github/workflows/linuxbuild.yml

This file was deleted.

52 changes: 41 additions & 11 deletions .github/workflows/macbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ name: macos build workflows

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

permissions:
contents: read
branches:
- 'develop'
paths:
- 'XEngine_Source/**'
- 'XEngine_Release/**'
- '.github/**'

jobs:
build:
strategy:
matrix:
include:
- os: macos-13
- os: macos-14
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -23,7 +24,6 @@ jobs:
with:
ref: 'develop'

# 检出依赖的xengine仓库到指定的xengine目录
- name: Checkout dependency repository (xengine)
uses: actions/checkout@v4
with:
Expand All @@ -41,14 +41,30 @@ jobs:
- name: install library
run: brew install srt srtp

# 设置依赖库的环境变量
- name: Set up Dependency Environment Variables
- name: Set up Dependency x86_64 Environment
if: matrix.os == 'macos-13'
run: |
cd libxengine
chmod 777 *
./XEngine_LINEnv.sh -i 3
cd ..
#编译
- name: Set up Dependency Arm64 Environment
if: matrix.os == 'macos-14'
run: |
cd libxengine
chmod 777 *
./XEngine_LINEnv.sh -i 0
latest_tag=$(git ls-remote --tags --sort="v:refname" https://github.com/libxengine/libxengine.git | awk '{print $2}' | sed 's/refs\/tags\///' | tail -n 1)
wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Mac_Arm64.zip
unzip ./XEngine_Mac_Arm64.zip -d ./XEngine_Mac_Arm64
cd XEngine_Mac_Arm64
sudo mkdir -p /usr/local/include
sudo mkdir -p /usr/local/lib
sudo cp -rf ./XEngine_Include /usr/local/include
sudo find ./XEngine_Mac -name "*.dylib" -exec cp {} /usr/local/lib \;
- name: make debug
run: |
cd XEngine_Source
Expand All @@ -64,3 +80,17 @@ jobs:
- name: test
run: |
cd XEngine_Release
./XEngine_StreamMediaApp -t
- name: Upload folder as artifact with mac x64
if: matrix.os == 'macos-13'
uses: actions/upload-artifact@v4
with:
name: XEngine_StreamMediaApp-x86_64-Mac
path: XEngine_Release/
- name: Upload folder as artifact with mac arm
if: matrix.os == 'macos-14'
uses: actions/upload-artifact@v4
with:
name: XEngine_StreamMediaApp-Arm64-Mac
path: XEngine_Release/
74 changes: 49 additions & 25 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,29 @@ name: windows build workflows

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

permissions:
contents: read
branches:
- 'develop'
paths:
- 'XEngine_Source/**'
- 'XEngine_Release/**'
- '.github/**'

jobs:
build:
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
configuration: [Debug ,Release]
platform: [x86 ,x64]

runs-on: windows-latest # 最新的 Windows 环境
runs-on: windows-latest

steps:
# 检出您的主仓库代码
- name: Checkout main repository code
uses: actions/checkout@v4
with:
ref: 'develop'

# 检出依赖的xengine仓库到指定的xengine目录
- name: Checkout dependency repository (xengine)
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -63,21 +60,33 @@ jobs:
./vcpkg.exe integrate install
shell: pwsh

# 设置依赖库的环境变量
- name: Set up Dependency Environment Variables
- name: Set up Dependency x86_64 Environment
if: matrix.platform == 'x64'
run: |
echo "XENGINE_INCLUDE=${{ github.workspace }}/libxengine" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "XENGINE_LIB32=${{ github.workspace }}/libxengine/XEngine_Windows/x86" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "XENGINE_LIB64=${{ github.workspace }}/libxengine/XEngine_Windows/x64" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "XENGINE_LIB64=${{ github.workspace }}/libxengine/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh

# 配置 MSBuild 的路径,准备构建 VC++ 项目
- name: Set up Dependency x86_32 Environment
if: matrix.platform == 'x86'
run: |
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/libxengine/libxengine/releases/latest" -Headers @{"Accept"="application/vnd.github.v3+json"}
$latest_tag = $response.tag_name
Write-Host "Latest Tag: $latest_tag"
$url = "https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Windows_x86-32.zip"
Invoke-WebRequest -Uri $url -OutFile "XEngine_Windows_x86-32.zip"
Expand-Archive -Path ./XEngine_Windows_x86-32.zip -DestinationPath ./XEngine_Windows -Force

echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "XENGINE_LIB32=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
#编译

- name: Build Solution
run: msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }}
#测试

- name: Conditional Step for x86 Release
if: matrix.configuration == 'Release' && matrix.platform == 'x86'
run: |
Expand All @@ -86,13 +95,28 @@ jobs:
cp -r XEngine_Source/VSCopy_x86.bat XEngine_Release/
cd XEngine_Release
.\VSCopy_x86.bat
./XEngine_StreamMediaApp -t
shell: pwsh
- name: Conditional Step for x86 Debug
if: matrix.configuration == 'Debug' && matrix.platform == 'x86'
- name: Conditional Step for x64 Debug
if: matrix.configuration == 'Release' && matrix.platform == 'x64'
run: |
cp -r XEngine_Source/Debug/*.dll XEngine_Release/
cp -r XEngine_Source/Debug/*.exe XEngine_Release/
cp -r XEngine_Source/VSCopy_x86.bat XEngine_Release/
cp -r XEngine_Source/x64/Release/*.dll XEngine_Release/
cp -r XEngine_Source/x64/Release/*.exe XEngine_Release/
cp -r XEngine_Source/VSCopy_x64.bat XEngine_Release/
cd XEngine_Release
.\VSCopy_x86.bat
shell: pwsh
.\VSCopy_x64.bat
shell: pwsh

- name: Upload folder as artifact with x86
if: matrix.configuration == 'Release' && matrix.platform == 'x86'
uses: actions/upload-artifact@v4
with:
name: XEngine_StreamMediaApp-x86_32-Windows
path: XEngine_Release/

- name: Upload folder as artifact with x64
if: matrix.configuration == 'Release' && matrix.platform == 'x64'
uses: actions/upload-artifact@v4
with:
name: XEngine_StreamMediaApp-x86_64-Windows
path: XEngine_Release/
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: release packet

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download ubuntubuild
uses: dawidd6/action-download-artifact@v6
with:
workflow: ubuntubuild.yml
workflow_conclusion: success
check_artifacts: false
skip_unpack: true
if_no_artifact_found: fail
path: ./XRelease/
- name: Download macbuild
uses: dawidd6/action-download-artifact@v6
with:
workflow: macbuild.yml
workflow_conclusion: success
check_artifacts: false
skip_unpack: true
if_no_artifact_found: fail
path: ./XRelease/
- name: Download msbuild
uses: dawidd6/action-download-artifact@v6
with:
workflow: msbuild.yml
workflow_conclusion: success
check_artifacts: false
skip_unpack: true
if_no_artifact_found: fail
path: ./XRelease/

- name: Display structure of downloaded files
run: ls -al ./XRelease/

- name: Get current version and increment X
id: versioning
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $latest_tag"
# 提取 X 的值并递增
major=$(echo $latest_tag | cut -d '.' -f 1)
minor=$(echo $latest_tag | cut -d '.' -f 2)
patch=$(echo $latest_tag | cut -d '.' -f 3)
build=$(echo $latest_tag | cut -d '.' -f 4)
new_minor=$((minor + 1))
new_version="$major.$new_minor.$patch.$build"
echo "New version: $new_version"
echo "new_tag=$new_version" >> $GITHUB_OUTPUT
echo "prev_tag=$latest_tag" >> $GITHUB_OUTPUT
- name: Create and push new tag
run: |
git tag ${{ steps.versioning.outputs.new_tag }}
git push origin ${{ steps.versioning.outputs.new_tag }}
- name: Generate release notes
run: |
logs=$(git log ${{ steps.versioning.outputs.prev_tag }}..${{ steps.versioning.outputs.new_tag }} --pretty=format:"* %h - %s - %an" --no-merges)
release_notes=$(echo "$logs" | sed 's/ qyt$/ @xengine-qyt/')
echo "$release_notes"
echo "$release_notes" > release_notes.txt
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
tag_name: ${{ steps.versioning.outputs.new_tag }}
name: XEngine_StreamMedia ${{ steps.versioning.outputs.new_tag }}
body_path: release_notes.txt
files: ./XRelease/*.zip
Loading

0 comments on commit fd761f5

Please sign in to comment.