Skip to content

Commit f6507b7

Browse files
authored
Merge pull request #557 from libtom/deploy-via-gh-actions
Deploy via gh actions
2 parents 787c614 + 9de2c22 commit f6507b7

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#############################################################################
2+
# #
3+
# Packagecloud deployment via GH actions for LibTomMath #
4+
# (https://github.com/libtom/libtommath.git) #
5+
# #
6+
#############################################################################
7+
8+
name: Deploy
9+
10+
on:
11+
workflow_dispatch
12+
13+
jobs:
14+
deploy-to-packagecloud:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ ubuntu-20.04, ubuntu-22.04 ]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: set Ubuntu codename
22+
run: |
23+
echo "ubuntu_codename="$(lsb_release -sc) >> "$GITHUB_ENV"
24+
- name: install dependencies
25+
run: |
26+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
27+
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${{ env.ubuntu_codename }} main" | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
28+
sudo apt-get update -qq
29+
sudo apt-get install -y cmake gcc
30+
- name: build static
31+
run: |
32+
mkdir -p build
33+
cd build
34+
cmake -DBUILD_SHARED_LIBS=Off -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
35+
make -j$(nproc)
36+
cpack -G DEB
37+
cmake -DBUILD_SHARED_LIBS=On -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
38+
make -j$(nproc)
39+
cpack -G DEB
40+
- name: push package to packagecloud.io
41+
uses: computology/packagecloud-github-action@v0.6
42+
with:
43+
PACKAGE-NAME: packages/ubuntu/${{ env.ubuntu_codename }}/*.deb
44+
PACKAGECLOUD-USERNAME: libtom
45+
PACKAGECLOUD-REPONAME: libtom
46+
PACKAGECLOUD-DISTRO: ubuntu/${{ env.ubuntu_codename }}
47+
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ else()
225225
set(DISTRO_PACK_PATH ${CMAKE_SYSTEM_NAME}/)
226226
endif()
227227

228+
# make sure untagged versions get a different package name
229+
execute_process(COMMAND git describe --exact-match --tags RESULT_VARIABLE REPO_HAS_TAG)
230+
if(REPO_HAS_TAG EQUAL 0)
231+
set(PACKAGE_NAME_SUFFIX "")
232+
else()
233+
set(PACKAGE_NAME_SUFFIX "-git")
234+
endif()
235+
228236
# default CPack generators
229237
set(CPACK_GENERATOR TGZ STGZ)
230238

@@ -245,6 +253,7 @@ if(BUILD_SHARED_LIBS)
245253
else()
246254
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-devel")
247255
endif()
256+
set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}${PACKAGE_NAME_SUFFIX}")
248257
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
249258
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LibTomMath")
250259
set(CPACK_PACKAGE_VENDOR "libtom projects")

0 commit comments

Comments
 (0)