@@ -3,117 +3,35 @@ name: Build and Release
33on :
44 push :
55 tags :
6- - ' v*' # Triggers the workflow when a tag starting with 'v' is pushed
6+ - ' v*.*.*' # Trigger only on version tags
7+ pull_request :
8+ tags :
9+ - ' v*.*.*' # Trigger only on version tags
710
811jobs :
912 build :
10- runs-on : ${{ matrix.os }}
11- strategy :
12- matrix :
13- os : [ubuntu-latest, macos-latest] # build for ubuntu and mac
14- arch : [x64, arm64] # x64 and arm
15- steps :
16- - name : Checkout code
17- uses : actions/checkout@v3
18-
19- - name : Set up build environment
20- run : |
21- if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
22- sudo apt-get update
23- sudo apt-get install -y autoconf gcc make cmake
24- elif [ ${{ matrix.os }} == 'macos-latest' ]; then
25- brew install autoconf gcc make cmake
26- fi
27-
28- - name : Build
29- run : |
30- cmake .
31- make
32- mkdir -p installation/usr/local/bin
33- make install DESTDIR=installation
13+ runs-on : ubuntu-latest
3414
35- - name : Extract version from github.ref
36- id : extract_version
37- run : echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/})"
38-
39- - name : Create tar.gz archive
40- run : |
41- cd installation/usr/local/bin
42- tar -czvf ../../../HELLO-${{ steps.extract_version.outputs.version }}.${{ matrix.os }}.${{ matrix.arch }}.tar.gz hello
43-
44- - name : Archive build artifacts
45- uses : actions/upload-artifact@v4
46- with :
47- name : HELLO-${{ matrix.os }}-${{ matrix.arch }}
48- path : installation/HELLO-${{ steps.extract_version.outputs.version }}.${{ matrix.os }}.${{ matrix.arch }}.tar.gz
49- if-no-files-found : error
50-
51- release :
52- needs : build
53- runs-on : ${{ matrix.os }}
54- strategy :
55- matrix :
56- os : [ubuntu-latest, macos-latest]
57- arch : [x64, arm64]
5815 steps :
59- - uses : actions/checkout@v3
16+ - name : Checkout code
17+ uses : actions/checkout@v2
6018
61- - name : Check if release exists
62- id : check_release
63- env :
64- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65- tag : ${{ github.ref_name }}
66- run : |
67- if gh release view "$tag" --repo="$GITHUB_REPOSITORY" > /dev/null 2>&1; then
68- echo "release_exists=true" >> $GITHUB_ENV
69- else
70- echo "release_exists=false" >> $GITHUB_ENV
71- fi
72-
73- - name : Create release
74- if : env.release_exists == 'false'
75- env :
76- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
77- tag : ${{ github.ref_name }}
78- run : |
79- gh release create "$tag" \
80- --repo="$GITHUB_REPOSITORY" \
81- --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
82- --generate-notes
19+ - name : Configure CMake
20+ run : cmake -S . -B build
8321
84- - name : Download build artifacts
85- uses : actions/download-artifact@v4
86- with :
87- pattern : HELLO-${{ matrix.os }}-${{ matrix.arch }}
88- path : ./artifacts
22+ - name : Build with CMake
23+ run : cmake --build build --config Release
8924
90- - name : List files in artifacts directory
25+ - name : Create zip archive of binaries
9126 run : |
92- echo "Listing files in ./artifacts:"
93- ls -l ./artifacts
27+ mkdir build_output
28+ cp build/ultra build_output/
29+ zip -r binaries_${{ github.ref_name }}.zip build_output/
30+ shell : bash
9431
95- - name : Upload Release Assets
96- uses : softprops/action-gh-release@v2
97- env :
98- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
99- with :
100- files : ./artifacts/HELLO-${{ matrix.os }}-${{ matrix.arch }}/*
101- tag_name : ${{ steps.extract_version.outputs.version }}
102- name : Release ${{ steps.extract_version.outputs.version }}
103- prerelease : false
104- draft : false
105- token : ${{ secrets.GITHUB_TOKEN }}
106-
107- - name : Set up Python
108- uses : actions/setup-python@v4
32+ - name : Upload binaries to GitHub Release
33+ uses : softprops/action-gh-release@v1
10934 with :
110- python-version : ' 3.x' # Specify the version of Python to use
111-
112- - name : Install dependencies
113- run : python -m pip install --upgrade pip && pip install requests
114-
115- - name : Run Python script
116- run : |
117- python .github/workflows/update_release_table.py ${{ github.ref_name }}
35+ files : binaries_${{ github.ref_name }}.zip
11836 env :
11937 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments