dist #28
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: dist | |
on: | |
workflow_run: | |
workflows: [build] | |
types: [completed] | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
version: | |
# test only | |
description: 'specify release tag name, default: 1.8.0' | |
# Default value if no value is explicitly provided | |
default: '1.8.0' | |
# Input has to be provided for the workflow to run | |
required: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "greet" | |
dist: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.inputs.version != '' }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check release version | |
id: check_ver | |
shell: pwsh | |
run: | | |
$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+)') } | |
if (!$matchInfo.Success) { $matchInfo = [Regex]::Match('${{github.event.inputs.version}}', '(\d+\.)+(-)?(\*|\d+)') } | |
$release_ver = if($matchInfo.Success) { $matchInfo.Value } else { '' } | |
echo "release_ver=$release_ver" | |
echo "release_ver=$release_ver" >> ${env:GITHUB_OUTPUT} | |
echo "release_tag=v$release_ver" >> ${env:GITHUB_OUTPUT} | |
- name: Download artifacts from workflow build | |
if: ${{ steps.check_ver.outputs.release_ver != '' }} | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
# Optional, GitHub token | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
# Required, workflow file name or ID | |
workflow: build.yml | |
workflow_conclusion: success | |
- name: Create packages | |
if: ${{ steps.check_ver.outputs.release_ver != '' }} | |
run: | | |
mkdir -p pkg_dir | |
prefix=glslcc-${{ steps.check_ver.outputs.release_ver }} | |
ls -l glslcc-linux | |
ls -l glslcc-osx-x64 | |
ls -l glslcc-osx-arm64 | |
sudo chmod u+x ./glslcc-linux/glslcc | |
sudo chmod u+x ./glslcc-osx-x64/glslcc | |
sudo chmod u+x ./glslcc-osx-arm64/glslcc | |
ls -l glslcc-linux | |
ls -l glslcc-osx-x64 | |
ls -l glslcc-osx-arm64 | |
tar -czvf ./pkg_dir/$prefix-linux.tar.gz -C ./glslcc-linux glslcc | |
tar -czvf ./pkg_dir/$prefix-osx-x64.tar.gz -C ./glslcc-osx-x64 glslcc | |
tar -czvf ./pkg_dir/$prefix-osx-arm64.tar.gz -C ./glslcc-osx-arm64 glslcc | |
curl 'https://github.com/simdsoft/1kiss/releases/download/devtools/d3dcompiler_47.dll' -o './glslcc-win64/d3dcompiler_47.dll' | |
sh -c "cd ./glslcc-win64; zip ../pkg_dir/$prefix-win64.zip glslcc.exe" | |
- name: Publish to github release page | |
if: ${{ steps.check_ver.outputs.release_ver != '' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.check_ver.outputs.release_tag }} | |
name: ${{ steps.check_ver.outputs.release_tag }} | |
files: | | |
./pkg_dir/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: axmolengine/glslcc |