From c712f1528af45fcd7859b28b084c3dce64d6e07c Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sat, 18 Apr 2026 18:00:50 +0300 Subject: [PATCH] Add CI/CD pipeline --- .github/workflows/ci_cd.yml | 61 +++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/ci_cd.yml diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..f4598cb --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index 3ecc8cc..2cd6697 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ /build /deb/temp /deb/out + +# Ignore act files +event.json