forked from septag/glslcc
-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (77 loc) · 3.29 KB
/
dist.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 -L '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