mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-15 23:46:12 +00:00
Add CI/CD pipeline
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
name: CI/CD pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch repository
|
||||
uses: actions/checkout@3
|
||||
- name: Upgrade packages
|
||||
run: apt update -y && apt upgrade -y
|
||||
- name: Download and install dependencies
|
||||
run: 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: 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@3
|
||||
- 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: apt update -y && apt upgrade -y
|
||||
- name: Download and install dependencies
|
||||
run: apt install -y 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 }}
|
||||
Reference in New Issue
Block a user