-
Notifications
You must be signed in to change notification settings - Fork 10
154 lines (139 loc) · 5.07 KB
/
GenerateRelease.yaml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Generate Release
on:
push:
tags: [ '*.*.*' ]
workflow_dispatch:
inputs:
name:
description: 'Release Name'
required: false
default: ''
type: string
tag: # Target tag to make a release for
description: 'Release Tag ()'
required: false
default: ''
type: string
is-draft: # Input that selects whether to make a draft release or a public release
description: 'Make Draft Release'
required: false
default: true
type: boolean
is-prerelease: # Input that selects whether to make a pre-release or normal release
description: 'Make Pre-Release'
required: false
default: false
type: boolean
autogenerate:
description: 'Autogenerate Release Notes From Commits'
required: false
default: false
type: boolean
body:
description: 'Release Body Paragraph'
required: false
default: ''
env:
# [PROJECT_NAME]
# Currently this is used for the following scenarios:
# - Executable Name
# - Build Subdirectory Name
# - Archive Name Prefix
PROJECT_NAME: 'ARRCON'
BUILD_TYPE: Release
jobs:
create-binaries:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-11 ]
fail-fast: true
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Project Dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y gcc-12 cmake ninja-build
gcc -v
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install gcc@10 cmake ninja
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
fi
shell: bash
- if: ${{ runner.os == 'Windows' }}
uses: ilammy/[email protected]
# Configure CMake Cache
# Windows
- name: Configure CMake (Windows)
if: ${{ runner.os == 'Windows' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja
# Linux/macOS
- name: Configure CMake (Linux/macOS)
if: ${{ runner.os != 'Windows' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja
env:
CC: gcc-12
CXX: g++-12
# Build Binary
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Create Packaged Release Archive
# Windows
- name: Create Archive (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
cd "${{github.workspace}}/build/${{env.PROJECT_NAME}}"
Compress-Archive "${{env.PROJECT_NAME}}.exe" "${{env.PROJECT_NAME}}-$(.\${{env.PROJECT_NAME}} -vq)-Windows.zip"
shell: powershell
# Linux / macOS
- name: Create Archive (Linux/macOS)
if: ${{ runner.os != 'Windows' }}
run: |
cd "${{github.workspace}}/build/${{env.PROJECT_NAME}}"
zip -T9 "${{env.PROJECT_NAME}}-$(./${{env.PROJECT_NAME}} -vq)-${{runner.os}}.zip" "${{env.PROJECT_NAME}}"
shell: bash
# Upload Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: latest-${{runner.os}}
path: '${{github.workspace}}/build/${{env.PROJECT_NAME}}/*.zip'
#:create-binaries
create-release:
needs: create-binaries
runs-on: ubuntu-latest
steps:
# Download Artifacts
- name: 'Download Build Artifacts'
uses: actions/download-artifact@v2
# Retrieve the latest git tag if this was triggered by a tag
- name: 'Get Release Tag'
id: get_version
run: |
if [ "${{github.event.inputs.tag}}" == "" ]; then TAG="${GITHUB_REF/refs\/tags\//}"; else TAG="${{github.event.inputs.tag}}" ; fi
echo ::set-output name=VERSION::$TAG
echo ::set-output name=NAME::"Release $TAG"
# Stage downloaded build artifacts for deployment
- name: 'Stage Archives'
run: |
cd ${{github.workspace}}
if mv ./latest-*/* ./ ; then ls -lAgh ; else ls -lAghR ; fi
shell: bash
# Upload Release
- name: 'Create Release'
#if: ${{ github.event_name == 'workflow_dispatch' }}
uses: softprops/action-gh-release@v1
with:
draft: ${{ github.event.inputs.is-draft || true }}
prerelease: ${{ github.event.inputs.is-prerelease || false }}
tag_name: ${{ steps.get_version.outputs.VERSION }}
name: ${{ steps.get_version.outputs.NAME }}
generate_release_notes: ${{ github.event.inputs.autogenerate || true }}
body: ${{ github.event.inputs.body || '' }}
fail_on_unmatched_files: true
files: ${{github.workspace}}/*.zip
#:create-release