publish #196
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
push: | |
paths: | |
- CHANGELOG.md | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
version: | |
# actions run ID | |
description: 'Please input release version, example: 2.1.0' | |
# Default value if no value is explicitly provided | |
default: 'auto' | |
# Input has to be provided for the workflow to run | |
required: false | |
jobs: | |
publish: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- 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 | |
if: ${{ steps.check_ver.outputs.release_ver == '' }} | |
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} | |
- name: Make package | |
if: ${{ steps.forward_ver.outputs.release_ver != '' }} | |
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: | | |
$AX_ROOT = $(pwd).Path | |
./setup.ps1 | |
./1k/fetch.ps1 -uri 'oboe' -prefix $(Join-Path $AX_ROOT 'cache') -manifest $(Join-Path $AX_ROOT 'manifest.json') | |
axmol -xc '-DAX_WITH_LZ4=ON,-DAX_WITH_CARES=ON,-DAX_WITH_YAML_CPP=ON,-DAX_WITH_KCP=ON' -c | |
./tools/ci/publish.ps1 -version "${{ steps.forward_ver.outputs.release_ver }}" | |
- name: Publish to github release page | |
if: ${{ steps.make_pkg.outputs.release_tag != '' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.make_pkg.outputs.release_tag }} | |
name: ${{ steps.make_pkg.outputs.release_tag }} | |
files: ${{ steps.make_pkg.outputs.release_pkg }} | |
body_path: ${{ steps.make_pkg.outputs.release_note }} | |
prerelease: ${{ steps.make_pkg.outputs.prerelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |