Skip to content

dist

dist #12

Workflow file for this run

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@v3
- 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: |
ls -R glslcc-win64
ls -R glslcc-linux
ls -R glslcc-osx
mkdir -p pkg_dir
prefix=glslcc-${{ steps.check_ver.outputs.release_ver }}
tar -czvf ./pkg_dir/$prefix-linux.tar.gz -C ./glslcc-linux glslcc
tar -czvf ./pkg_dir/$prefix-osx.tar.gz -C ./glslcc-osx glslcc
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@v1
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