Repository navigation
Expand file tree
/
Copy pathc-cpp-windows-build-template.yml
More file actions
77 lines (77 loc) · 2.59 KB
/
Copy pathc-cpp-windows-build-template.yml
File metadata and controls
77 lines (77 loc) · 2.59 KB
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
# SPDX-FileCopyrightText: Copyright (C) 2025 Fabrício Barros Cabral
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
name: c-cpp-windows-build-template
'on':
workflow_call:
inputs:
working-directory:
description: "Set the working directory"
required: false
default: "."
type: string
defaults:
run:
shell: msys2 {0}
permissions:
contents: read
jobs:
c-cpp-windows-build-template:
runs-on: windows-2025
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install and setup MSYS2 with MinGW64
uses: msys2/setup-msys2@fb197b72ce45fb24f17bf3f807a388985654d1f2
with:
msystem: MINGW64
update: true
install: >-
base-devel
autoconf
automake
libtool
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-make
mingw-w64-x86_64-pkgconf
- name: Configure and build
working-directory: ${{ inputs.working-directory }}
run: |
[[ -x ./autogen.sh ]] && ./autogen.sh
[[ -x ./configure ]] && ./configure --host=x86_64-w64-mingw64
[[ -s Makefile ]] || {
echo "I couldn't find an autogen.sh, configure, or Makefile."
echo "Please check your files."
exit 1
}
make
- name: Get properties from configure.ac
working-directory: ${{ inputs.working-directory }}
id: props
run: |
name="$(sed -n 's/AC_INIT(\[\([^]]*\)\],.*/\1/p' configure.ac)"
echo "name=${name}" >> "${GITHUB_OUTPUT}"
version="$(sed -n 's/AC_INIT(\[[^]]*\], \[\([^]]*\)\], \[[^]]*\])/\1/p' configure.ac)"
echo "version=${version}" >> "${GITHUB_OUTPUT}"
- name: Create source package
working-directory: ${{ inputs.working-directory }}
run: |
make dist
- name: Create Windows binary package
working-directory: ${{ inputs.working-directory }}
run: |
make binary-dist
- name: Prepare packages to distribution
working-directory: ${{ inputs.working-directory }}
run: |
mkdir dist
mv "${{ steps.props.outputs.name }}-${{ steps.props.outputs.version }}-bin.tar.gz" \
"dist/${{ steps.props.outputs.name }}-${{ steps.props.outputs.version }}-windows.tar.gz"
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: windows-dist
path: "${{ inputs.working-directory }}/dist/*.tar.gz"