forked from fossology/fossology
-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (167 loc) · 6.06 KB
/
release-publish.yml
File metadata and controls
196 lines (167 loc) · 6.06 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# SPDX-FileCopyrightText: © 2021 Siemens AG
# SPDX-FileCopyrightText: © Gaurav Mishra <mishra.gaurav@siemens.com>
# SPDX-License-Identifier: GPL-2.0-only AND LGPL-2.1-only
name: Publish Release Packages
on:
release:
types:
- published
env:
DEBIAN_FRONTEND: noninteractive
jobs:
release-build:
strategy:
matrix:
os:
- 'debian:bullseye'
- 'debian:bookworm'
- 'debian:trixie'
- 'ubuntu:jammy'
- 'ubuntu:noble'
runs-on: ubuntu-latest
container: ${{ matrix.os }}
continue-on-error: true
steps:
- name: Install git
run: |
apt-get update
apt-get install -y lsb-release sudo gpg ca-certificates
## Add repo for latest git
if case "${{ matrix.os }}" in ubuntu*) true;; *) false;; esac; then
apt-get install -y software-properties-common
add-apt-repository $GIT_REPO -y
fi
apt-get update
apt-get install git -y
# Remove added repos
if case "${{ matrix.os }}" in ubuntu*) true;; *) false;; esac; then
add-apt-repository --remove $GIT_REPO -y
fi
apt-get update
env:
GIT_REPO: "ppa:git-core/ppa"
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
run: |
apt-get install --no-install-recommends -y wget lsb-release sudo composer curl php-cli
apt-get install --no-install-recommends -y libcppunit-dev libcunit1-dev libdbd-sqlite3-perl
apt-get install --no-install-recommends -y php-sqlite3 php-zip tar debhelper libssl-dev postgresql-server-dev-all
sudo chown -R $(id -u):$(id -g) .
./utils/fo-installdeps -y -b
./install/scripts/install-spdx-tools.sh
rm -rf src/vendor
- name: Get CMake
uses: lukka/get-cmake@v4.1.2
- name: Fetch tags
run: |
git fetch --tags
- name: Get release info
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Set environment
env:
VERSION: ${{ steps.get_release.outputs.tag_name }}
run: |
echo PACKAGE_NAME=$(echo "FOSSology-${VERSION}-$(lsb_release -si | tr [:upper:] [:lower:])-$(lsb_release -sc | tr [:upper:] [:lower:]).tar.gz") >> $GITHUB_ENV
- name: Configure and Generate CMake Project
run: |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DFO_SYSCONFDIR=/etc/fossology -DFO_LOCALSTATEDIR=/var -S. -B./build -G Ninja
- name: Build Debs
run: |
cmake --build build --parallel
cd build && cpack --config CPackConfig.cmake
# Generate random number between 3-22 for sleep in next step
echo DELAY_DURATION=$((4 + RANDOM % 20)) >> $GITHUB_ENV
- name: Rename package
run: |
find build -type f -name "*-dbgsym*" -delete
mkdir -p packages
mv build/*.deb packages/
tar -czvf ${PACKAGE_NAME} packages
# Sleep for DELAY_DURATION seconds to allow GitHub API accept new packages
sleep "${DELAY_DURATION}s"
- name: Upload Release Asset
id: upload-release-asset
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ env.PACKAGE_NAME }}
asset_name: ${{ env.PACKAGE_NAME }}
asset_content_type: application/gzip
github_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
docker-release-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get release info
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push main image
uses: docker/build-push-action@v6
with:
push: true
tags: fossology/fossology:${{ steps.get_release.outputs.tag_name }}
labels: |
org.opencontainers.image.version=${{ steps.get_release.outputs.tag_name }}.0
context: .
- name: Build and push runner image
uses: docker/build-push-action@v6
with:
push: true
tags: fossology/fossology:${{ steps.get_release.outputs.tag_name }}-scanner
file: utils/automation/Dockerfile.ci
labels: |
org.opencontainers.image.version=${{ steps.get_release.outputs.tag_name }}.0
nomossa-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y build-essential pkg-config libglib2.0-dev \
libjson-c-dev librpm-dev libboost-all-dev libxslt1-dev
- name: Setup CMake
uses: lukka/get-cmake@v4.1.2
- name: Build Nomossa
run: |
mkdir -p nomossa-build
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DAGENTS="nomos" -DBUILD_SHARED_LIBS="off" -DCMAKE_EXE_LINKER_FLAGS="-static" -B nomossa-build -S . -G Ninja
ninja -C ./nomossa-build/ nomossa
- name: Get release info
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Nomossa Binary
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: nomossa-build/src/nomos/agent/nomossa
asset_name: FOSSology-nomossa
asset_content_type: application/octet-stream
github_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true