forked from The-OpenROAD-Project/OpenROAD
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.46 KB
/
github-actions-build-deb-package.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
name: Build deb packages
on:
push:
branches:
- master
jobs:
builder:
name: 'Build .deb package'
strategy:
fail-fast: false
matrix:
os: ['debian10', 'debian11', 'ubuntu20.04', 'ubuntu22.04']
runs-on: ubuntu-latest
container:
image: openroad/${{ matrix.os }}-dev
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build package
run: |
mkdir artifacts
debuild --preserve-env --preserve-envvar=PATH -B
mv ../openroad_* artifacts
- name: Rename artifact
id: artifact
run: |
cd artifacts
file=$(realpath openroad_*.deb)
artifact=$(echo $file | sed 's/\.\([^.]*\)$/-${{ matrix.os }}.\1/')
mv $file $artifact
echo "file=$(realpath $artifact)" >> $GITHUB_OUTPUT
name=$(basename $artifact)
name=${name%.deb}
echo "name=$name" >> $GITHUB_OUTPUT
- name: Upload workflow artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.name }}
path: ${{ steps.artifact.outputs.file }}
- name: Set release version
id: set_version
run: echo "RELEASE_VERSION=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Get release info
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
doNotFailIfNotFound: true
id: release_info
- name: Create release if not exists
if: steps.release_info.outputs.name == ''
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
body: "Release"
id: create_release
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_info.outputs.upload_url || steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.artifact.outputs.file }}
asset_name: ${{ steps.artifact.outputs.name }}-${{ env.RELEASE_VERSION }}.deb
asset_content_type: application/octet-stream