-
-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (158 loc) · 5.63 KB
/
release.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
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
155
156
157
158
name: release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install deps
run: sudo make deb-install-deps
- name: build static binary
run: make mh-static OPTS=-lpthread
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mh-linux-x86_64
path: ./mh-linux-x86_64
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mh-linux-x86_64
asset_name: mh-linux-x86_64
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-deb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: 'mh'
- name: build deb package
run: |
cd mh
git fetch --tags --force
git fetch --unshallow
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace debian:buster bash -c "apt-get update && apt install -y build-essential git pkg-config && git config --global --add safe.directory /workspace/mh && make -C mh deb-install-deps deb-export-archive deb-version deb-build"
ls ..
- name: list files
run: ls -l
- name: Extract Git Tag
run: |
# Retrieve the current tag
VERSION=$(git describe --tags --abbrev=0)
VERSION=${VERSION#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: upload artifcat
uses: actions/upload-artifact@v4
with:
name: mh_${VERSION}-1_amd64.deb
path: mh_${VERSION}-1_amd64.deb
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mh_${VERSION}-1_amd64.deb
asset_name: mh_${VERSION}-1_amd64.deb
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-osx-amd64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Check for Homebrew
run: |
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: update brew
run: brew update
- name: Install Python and Handle Symlink Conflicts
run: |
# Install [email protected]
arch -x86_64 /usr/local/bin/brew install [email protected] || true # Continue even if there's a conflict
# Link [email protected]
brew link --overwrite [email protected]
- name: install libs
run: |
arch -x86_64 /usr/local/bin/brew install pcre2 cmocka llvm pkg-config
- name: Install dependencies
run: |
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> $GITHUB_ENV
echo 'export LDFLAGS="-L/usr/local/opt/llvm/lib"' >> $GITHUB_ENV
echo 'export CPPFLAGS="-I/usr/local/opt/llvm/include"' >> $GITHUB_ENV
- name: build
run: |
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
make mh CC=clang LIBS="$(/usr/local/bin/pkg-config --cflags --libs libpcre2-8) -lpthread" CPPFLAGS="-target x86_64-apple-macos11" PROGNAME=mh-$(uname -o | tr '[:upper:]' '[:lower:]')-x86_64-apple-macos11
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mh-darwin-x86_64-apple-macos11
path: mh-darwin-x86_64-apple-macos11
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mh-darwin-x86_64-apple-macos11
asset_name: mh-darwin-x86_64-apple-macos11
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-osx-arm:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Check for Homebrew
run: |
if test ! $(which brew); then
echo "Homebrew not found"
exit 1
fi
- name: update brew
run: brew update
- name: install libs
run: brew install pcre2 cmocka
- name: Install dependencies
run: |
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> $GITHUB_ENV
echo 'export LDFLAGS="-L/usr/local/opt/llvm/lib"' >> $GITHUB_ENV
echo 'export CPPFLAGS="-I/usr/local/opt/llvm/include"' >> $GITHUB_ENV
- name: build
run: |
make mh CC=clang LIBS="$(pkg-config --cflags --libs libpcre2-8) -lpthread" PROGNAME=mh-$(uname -o | tr '[:upper:]' '[:lower:]')-$(uname -m)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mh-darwin-arm64
path: mh-darwin-arm64
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mh-darwin-arm64
asset_name: mh-darwin-arm64
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create_release:
runs-on: ubuntu-latest
needs: [build, build-deb, build-osx-arm, build-osx-amd64]
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: "Release ${{ github.ref }}"
body: "Release notes or description"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}