-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (80 loc) · 2.46 KB
/
make-release.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
name: Make Release
on:
push:
tags: [ '[0-9]+.[0-9]+.[0-9]+-?**' ]
workflow_dispatch:
inputs:
tag_name:
description: 'The tag to create the release for.'
required: true
default: ''
type: string
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
fail-fast: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
ref: '${{ github.event.inputs.tag_name || github.event.inputs.ref }}'
- name: Setup Dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y gcc-10 cmake ninja-build
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/msvc-dev-cmd@v1
- name: Configure
run: cmake -B out/build -DCMAKE_BUILD_TYPE=Release -G Ninja
- name: Build
run: cmake --build out/build --config Release
env:
CC: gcc
CXX: g++
- name: Compress
if: ${{ runner.os == 'Windows' }}
run: |
cd out/build/calc
Compress-Archive calc.exe "calc-$(./calc -v)-Windows.zip"
shell: pwsh
- name: Compress
if: ${{ runner.os != 'Windows' }}
run: |
cd out/build/calc
zip -T9 "calc-$(./calc -v)-${{ runner.os }}.zip" calc
shell: bash
- name: Upload
uses: actions/upload-artifact@v4
with:
name: binary-${{ runner.os }}
path: ${{ github.workspace }}/out/build/calc/*.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- run: mv binary-*/* .
- name: Get tag name
id: get_tag
run: |
if [ "${{github.event.inputs.tag}}" == "" ]; then TAG="${GITHUB_REF/refs\/tags\//}"; else TAG="${{github.event.inputs.tag}}" ; fi
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
tag_name: ${{ steps.get_tag.outputs.tag_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: "*.zip"