axmol/.github/workflows/publish.yml

77 lines
2.8 KiB
YAML
Raw Normal View History

2023-12-20 20:30:02 +08:00
name: publish
on:
2024-02-24 21:45:01 +08:00
push:
paths:
- CHANGELOG.md
2023-12-20 20:30:02 +08:00
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# actions run ID
2023-12-21 23:59:24 +08:00
description: 'Please input release version, example: 2.1.0'
2023-12-20 20:30:02 +08:00
# Default value if no value is explicitly provided
2023-12-21 23:59:24 +08:00
default: 'auto'
2023-12-20 20:30:02 +08:00
# Input has to be provided for the workflow to run
required: false
jobs:
publish:
runs-on: windows-latest
2023-12-20 20:30:02 +08:00
steps:
2024-02-02 00:42:42 +08:00
- uses: actions/checkout@v4
2023-12-20 20:30:02 +08:00
with:
submodules: 'recursive'
2023-12-21 23:59:24 +08:00
- name: Check release ver from input
if: ${{ github.event.inputs.version != '' }}
id: check_ver
shell: pwsh
run: |
$release_ver = '${{ github.event.inputs.version }}'
echo "release_ver=$release_ver" >> ${env:GITHUB_OUTPUT}
echo "release_ver=$release_ver" >> ${env:GITHUB_ENV}
- name: Check release ver from commits
2024-02-24 21:41:56 +08:00
if: ${{ steps.check_ver.outputs.release_ver == '' }}
2023-12-21 23:59:24 +08:00
shell: pwsh
run: |
# commit message template: xxxx [release 2.1.0]
$commit_msg = "$(git show -s --format=%s)"
echo "commit_msg: $commit_msg"
$matchInfo = [Regex]::Match($commit_msg, '\[release\s(\d+\.)+(-)?(\*|\d+)\]')
if ($matchInfo.Success) { $matchInfo = [Regex]::Match($matchInfo.Value, '(\d+\.)+(-)?(\*|\d+)') }
$release_ver = if($matchInfo.Success) { $matchInfo.Value }
echo "release_ver=$release_ver" >> ${env:GITHUB_ENV}
- name: Forward release ver to step make_pkg
id: forward_ver
shell: pwsh
run: |
echo "Forwarding release_ver=$env:release_ver ..."
echo "release_ver=$env:release_ver" >> ${env:GITHUB_OUTPUT}
2023-12-20 20:30:02 +08:00
- name: Make package
2023-12-21 23:59:24 +08:00
if: ${{ steps.forward_ver.outputs.release_ver != '' }}
2023-12-20 20:30:02 +08:00
id: make_pkg
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
shell: pwsh
run: |
2023-12-21 23:59:24 +08:00
$AX_ROOT = $(pwd).Path
2024-03-31 00:01:03 +08:00
./1k/fetch.ps1 -uri 'oboe' -prefix $(Join-Path $AX_ROOT 'cache') -manifest $(Join-Path $AX_ROOT 'manifest.json')
2023-12-21 23:59:24 +08:00
./build.ps1 -xc '-DAX_WITH_LZ4=ON,-DAX_WITH_CARES=ON,-DAX_WITH_YAML_CPP=ON,-DAX_WITH_KCP=ON' -c
2024-02-25 12:38:16 +08:00
./tools/ci/publish.ps1 -version "${{ steps.forward_ver.outputs.release_ver }}"
2023-12-20 20:30:02 +08:00
- name: Publish to github release page
2023-12-21 23:59:24 +08:00
if: ${{ steps.make_pkg.outputs.release_tag != '' }}
2023-12-20 20:30:02 +08:00
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.make_pkg.outputs.release_tag }}
name: ${{ steps.make_pkg.outputs.release_tag }}
files: ${{ steps.make_pkg.outputs.release_pkg }}
2023-12-21 23:59:24 +08:00
body_path: ${{ steps.make_pkg.outputs.release_note }}
2024-02-22 20:26:12 +08:00
prerelease: ${{ steps.make_pkg.outputs.prerelease }}
2023-12-20 20:30:02 +08:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}