|
| 1 | +name: CI/CD pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "**" |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Fetch repository |
| 16 | + uses: actions/checkout@v6 |
| 17 | + - name: Upgrade packages |
| 18 | + run: sudo apt update -y && sudo apt upgrade -y |
| 19 | + - name: Download and install dependencies |
| 20 | + run: sudo apt install -y make golang libgl-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev |
| 21 | + - name: Build using make |
| 22 | + run: make PREFIX=/usr SYSCONFDIR=/etc |
| 23 | + - name: Install to root using make |
| 24 | + run: sudo make PREFIX=/usr SYSCONFDIR=/etc install |
| 25 | + - name: Run stormfetch |
| 26 | + run: stormfetch |
| 27 | + publish: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + needs: test |
| 30 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && needs.test.result == 'success' |
| 31 | + steps: |
| 32 | + - name: Fetch repository |
| 33 | + uses: actions/checkout@v6 |
| 34 | + - name: Check debian changelog version |
| 35 | + run: test $(grep '^stormfetch' debian/changelog | head -n1 | grep -Po '(?<=\().*(?=\))' | cut -d '-' -f1) == ${{ github.ref_name }} |
| 36 | + - name: Upgrade packages |
| 37 | + run: sudo apt update -y && sudo apt upgrade -y |
| 38 | + - name: Download and install dependencies |
| 39 | + run: sudo apt install -y make debhelper golang libgl-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev |
| 40 | + - name: Build deb package |
| 41 | + run: dpkg-buildpackage -b |
| 42 | + - name: Read changelog |
| 43 | + id: read_changelog |
| 44 | + run: | |
| 45 | + r=$(cat CHANGELOG.md) # Read CHANGELOG.md |
| 46 | + r="${r//'%'/'%25'}" # Multiline escape sequences for % |
| 47 | + r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n' |
| 48 | + r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r' |
| 49 | + echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT # Set environment variable |
| 50 | + - name: Upload deb packages release |
| 51 | + uses: svenstaro/upload-release-action@v2 |
| 52 | + with: |
| 53 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + release_name: v${{ github.ref_name }} |
| 55 | + file: ../*.deb |
| 56 | + tag: ${{ github.ref }} |
| 57 | + overwrite: true |
| 58 | + file_glob: true |
| 59 | + draft: true |
| 60 | + body: | |
| 61 | + ${{ steps.read_changelog.outputs.RELEASE_BODY }} |
0 commit comments