-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (61 loc) · 2.38 KB
/
Copy pathci_cd.yml
File metadata and controls
63 lines (61 loc) · 2.38 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
name: CI/CD pipeline
on:
push:
branches:
- "**"
tags:
- "*"
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Fetch repository
uses: actions/checkout@v6
- name: Upgrade packages
run: sudo apt update -y && sudo apt upgrade -y
- name: Download and install dependencies
run: sudo apt install -y make golang libgl-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev
- name: Build using make
run: make PREFIX=/usr SYSCONFDIR=/etc
- name: Install to root using make
run: sudo make PREFIX=/usr SYSCONFDIR=/etc install
- name: Run stormfetch
run: stormfetch
publish:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && needs.test.result == 'success'
steps:
- name: Fetch repository
uses: actions/checkout@v6
- name: Check debian changelog version
run: test $(grep '^stormfetch' debian/changelog | head -n1 | grep -Po '(?<=\().*(?=\))' | cut -d '-' -f1) == ${{ github.ref_name }}
- name: Upgrade packages
run: sudo apt update -y && sudo apt upgrade -y
- name: Download and install dependencies
run: sudo apt install -y build-essential make debhelper golang libgl-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev
- name: Build deb package
run: dpkg-buildpackage -b
- name: Read changelog
id: read_changelog
run: |
r=$(cat CHANGELOG.md) # Read CHANGELOG.md
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT # Set environment variable
- name: Upload deb packages release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: v${{ github.ref_name }}
file: ../*.deb
tag: ${{ github.ref }}
overwrite: true
file_glob: true
draft: true
body: |
${{ steps.read_changelog.outputs.RELEASE_BODY }}